Grid Search Algorithm¶
Grid Search¶
- class orion.algo.gridsearch.GridSearch(space, n_values=100, seed=None)[source]¶
Grid Search algorithm
- Parameters
- n_values: int or dict
Number of trials for each dimensions, or dictionary specifying number of trials for each dimension independently (name, n_values). For categorical dimensions, n_values will not be used, and all categories will be used to build the grid.
- Attributes
configuration
Return tunable elements of this algorithm in a dictionary form appropriate for saving.
is_done
Return True when all grid has been covered.
- requires_dist
- requires_type
state_dict
Return a state dict that can be used to reset the state of the algorithm.
Methods
build_grid
(space, n_values[, max_trials])Build a grid of trials
set_state
(state_dict)Reset the state of the algorithm based on the given state_dict
suggest
(num)Return the entire grid of suggestions
- static build_grid(space, n_values, max_trials=10000)[source]¶
Build a grid of trials
- Parameters
- n_values: int or dict
Number of trials for each dimensions, or dictionary specifying number of trials for each dimension independently (name, n_values). For categorical dimensions, n_values will not be used, and all categories will be used to build the grid.
- max_trials: int
Maximum number of trials for the grid. If n_values lead to more trials than max_trials, the n_values will be adjusted down. Will raise ValueError if it is impossible to build a grid smaller than max_trials (for instance if choices are too large).
- property configuration¶
Return tunable elements of this algorithm in a dictionary form appropriate for saving.
- property is_done¶
Return True when all grid has been covered.
- set_state(state_dict)[source]¶
Reset the state of the algorithm based on the given state_dict
- Parameters
- state_dict: dict
Dictionary representing state of an algorithm
- property state_dict¶
Return a state dict that can be used to reset the state of the algorithm.
- suggest(num)[source]¶
Return the entire grid of suggestions
- Returns
- list of trials or None
A list of lists representing trials suggested by the algorithm. The algorithm may opt out if it cannot make a good suggestion at the moment (it may be waiting for other trials to complete), in which case it will return None.