Grid Search is the process of choosing a set of parameters for a learning algorithm, usually with the goal of optimizing a measure of the algorithm's performance on an independent data set.
With cnvrg you can fire up several experiments in parallel with a single command. This feature is very useful for grid search and hyperparameter optimization.
To do so, you will need a hyperparameter YAML file that will contain information about the parameters, and their possible values.
In the YAML file, each parameter has a param_name that should match the argument that is fed to the experiment. So the parameter name:
kernel will create a new experiment with this string is attached:
rbf is one of the possible parameters.
To trigger the grid search, please run your file using the following command:
cnvrg run --medium --grid=src/hyper.yaml python myscript.py
Below you can see an example yaml file:
(This file is automatically created when initializing a project via cnvrg CLI)
parameters: # Integer parameter is a range of possible values between a minimum (inclusive) # and maximum (not inclusive) values. Values are floored (0.7 => 0) - param_name: "learning_rate" type: "integer" min: 0 # inclusive max: 10 # not inclusive scale: "linear" steps: 4 # The number of linear steps to produce. # Float parameter is a range of possible values between a minimum (inclusive) # and maximum (not inclusive) values. # - param_name: "learning_rate" type: "float" # precision is 9 after period min: 0.00001 max: 0.1 scale: "log2" # Could be log10 as well steps: 2 # Discrete parameter is an array of numerical values. # - param_name: "c" type: "discrete" values: [0, 0.1 ,0.001] # Categorical parameter is an array of string values # - param_name: "kernel" type: "categorical" values: ["linear", "poly", "rbf"]