dival.hyper_param_search module
Optimization of hyper parameters.
Both grid search and random search using the hyperopt
library are
supported.
The hyper parameter specification of a reconstructor class, optionally
including default options for optimization, are specified in the class
attribute HYPER_PARAMS
.
- dival.hyper_param_search.optimize_hyper_params(reconstructor, validation_data, measure, dataset=None, HYPER_PARAMS_override=None, hyperopt_max_evals=1000, hyperopt_max_evals_retrain=1000, hyperopt_rstate=None, show_progressbar=True, tqdm_file=None)[source]
Optimize hyper parameters of a reconstructor.
- Parameters:
reconstructor (
Reconstructor
) – The reconstructor.validation_data (
DataPairs
) – The test data on which the performance is measured.measure (
Measure
or str) – The measure to use as the objective. The sign is chosen automatically depending on the measuresmeasure_type
.dataset (
Dataset
, optional) – The dataset used for training reconstructor if it is aLearnedReconstructor
.HYPER_PARAMS_override (dict, optional) – Hyper parameter specification overriding the defaults in
type(reconstructor).HYPER_PARAMS
. The structure of this dict is the same as the structure ofReconstructor.HYPER_PARAMS
, except that all fields are optional. Here, each value of a dict for one parameter is treated as an entity, i.e. specifying the dictHYPER_PARAMS[...]['grid_search_options']
overrides the whole dict, not only the specified keys in it.hyperopt_max_evals (int, optional) – Number of evaluations for different combinations of the parameters that are optimized by
hyperopt
and that do not require retraining. Should be chosen depending on the complexity of dependence and the number of such parameters.hyperopt_max_evals_retrain (int, optional) – Number of evaluations for different combinations of the parameters that are optimized by
hyperopt
and that require retraining. Should be chosen depending on the complexity of dependence and the number of such parameters.hyperopt_rstate (
np.random.RandomState
, optional) – Random state for the random searches performed byhyperopt
.show_progressbar (bool, optional) – Whether to show a progress bar for the optimization. Default:
True
.tqdm_file (file-like object) – File/stream to pass to
tqdm
.