[help] Nested static branching #170
-
Help
DescriptionHi there, I have a question about the best practice for how to do static branching. I want to use targets to support the data simulation process for method development/validation involving simulating an environment and then various data sampling procedures. This data generation process has a number of steps (currently 6 but might become more) and the branching can occur at each step. I might want to explore the impact of changes occurring at each data generation step. Each step is dependant on the output of the previous. I've put together a gist file with the full example: https://gist.github.com/simonrolph/735f4c6eb5994407535543225d7ad484 I made a dummy data generation process at the top of the script. I want to be able to set parameters for each of the data generation steps. So in this example I have a branching of 2, then each of these branches branch again into 2, then again into 3.
Just as a thought exercise I did it all in a single mapping. This overcomes the indentation step, but ignores that the branching happens at each of the data generation process so I'm doing lots of unneeded computation, so this is bad, although it's very readable:
So I was first thinking I want to use 'static' branching as I am pre-defining the branches. First attempt using tar_map:
This is fine, it's readable, however in my real workflow the increased indentation gets quite awkward. Also it's not possible to do tar_combine because I haven't defined my mappings (or so I believe) I thought about re defining my mappings (in order to be able to do tar_combine) in advance but because of the nesting they end up in reverse order which is very counterintuitive, I want to write my pipeline starting at the beginning:
I then looked at using dynamic branching and used
In summary, all the solutions I came up don't seem quite satisfactory, primarily about the readability. Especially as I might want to share this pipeline and make it easy for someone to edit it and define their own data generation for their use-case. I was wondering if anyone had any better ideas about how to implement nested static branching? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I like pipeline 3 in the gist, but that's just my personal preference. For many of these options, it comes down to style. You can often make up for a lack of readability with the custom |
Beta Was this translation helpful? Give feedback.
I like pipeline 3 in the gist, but that's just my personal preference. For many of these options, it comes down to style. You can often make up for a lack of readability with the custom
description
/descriptions
arguments oftar_target()
andtar_map()
, plustar_network(label = "description")