Gridsearch¶
When trying to find the right hyperparameters for your neural network, sometimes you just have to do a lot of trial and error. Currently, our Gridsearch implementation is pretty basic, but it allows you to supply ranges of input values for various metaparameters and then executes training runs in either random or sequential fashion.
Warning: this class is a bit underdeveloped. Tread with care.
Gridsearch¶
-
class
pywick.gridsearch.gridsearch.
GridSearch
(function, grid_params, search_behavior='exhaustive', args_as_dict=True)[source]¶ Simple GridSearch to apply to a generic function
Parameters: - function – (function): function to perform grid search on
- grid_params –
(dict): dictionary mapping variable names to lists of possible inputs aka..
{‘input_a’:[‘dog’, ‘cat’, ‘stuff’], ‘input_b’:[3, 10, 22]}
- search_behavior –
(string): how to perform the search. Options are: ‘exhaustive’, ‘sampled_x.x’ (where x.x is sample threshold 0.0 < 1.0)
exhaustive - try every parameter in order they are specified in the dictionary (last key gets all its values searched first)
sampled - sample from the dictionary of params with specified threshold. The random tries below the threshold will be executed
- args_as_dict –
(bool): There are two ways to pass parameters into a function:
1. Simply use each key in grid_params as a variable to pass to the function (and change those variable values according to the mapping inside grid_params)
2. Pass a single dictionary to the function where the keys of the dictionary themselves are changed according to the grid_params
defaults to dict
Pipeline¶
-
class
pywick.gridsearch.pipeline.
Pipeline
(ordered_func_list, func_args=None)[source]¶ Defines a pipeline for operating on data. Output of first function will be passed to the second and so forth.
Parameters: - ordered_func_list – (list): list of functions to call
- func_args – (dict): optional dictionary of params to pass to functions in addition to last output the dictionary should be in the form of: func_name: list(params)
-
add_after
(func, args_dict=None)[source]¶ Add a function to be applied at the end of the pipeline
Parameters: func – The function to apply
-
add_before
(func, args_dict=None)[source]¶ Add a function to be applied before the rest in the pipeline
Parameters: func – The function to apply