How to use a Parameter Sweep
Parameter Sweep steps allow you to run a Model many times within a Workflow, iterating over one or more parameters.
While similar to Loop steps, there are several key differences, which are summarised below:
Loop | Parameter Sweep | |
---|---|---|
Iterates over | Workflows | Models |
Maximum iterations per Workflow | 50 | 4,000 |
Iterates dataslots | ✔ | |
Iterates parameters | ✔ | ✔ |
Requires Model modification | ✔ |
Using the step
Parameter Sweep steps can be added to Workflows just like Model steps - simply drag the step onto the central Workflow area, and select the Model you wish to use.
When creating a Parameter Set, you can select the 'Iterate Values' option next to any parameter to iterate it. Multiple parameters may be iterated over in a single Parameter Sweep step.
You can add a list of parameter values by pressing 'Enter' after each value. Parameters with a fixed list of choices may be selected from a dropdown menu instead.
Alternatively, numerical parameters may have their values generated automatically. To do this, select the 'Generate Values' checkbox. You may then enter the number of values you wish to generate, select a distribution, and define the parameters of the distribution. For more information, see the documentation on Loop step parameters.
Your Model will be run once for each combination of parameters. For example, if two parameters are selected to be iterated over, each with three choices, the Model will run a total of 9 times.
Modifying your Model
All iterations of a Parameter Sweep step share the same storage. This means that if your Model writes to a fixed output file, it will be overwritten as each iteration runs.
To avoid this issue, you will need to modify your Model to save its output in a different file for each iteration. A simple way to do this would be to name the output file based on a combination of the input parameters. Alternatively, you could generate a random UUID for each file.
For example, if running a Parameter Sweep using a numerical parameter with the possible values 1, 2, and 3, and a string parameter with the possible values A and B, you could generate the output file names output_1_A.csv
, output_1_B.csv
, output_2_A.csv
, and so on.
If you are unable to edit the model that you are running, it may not be possible to use a Parameter Sweep step. Please consider using a Loop step instead.
Considerations
Parameter Sweep steps with large numbers of iterations may take a long time to run. Please consider the runtime of your Model when creating a Parameter Set, and be considerate of other users of the platform.
There is a limit of 4,000 Parameter Sweep step iterations per Workflow.