Hyperopt
Ver. 1.1.1 (2022-10-17)
This module provides a wrapper class for hyperparameter tuning by reusing the Hyperopt framework.
See also: https://pypi.org/project/hyperopt/
- class mlpro.wrappers.hyperopt.WrHPTHyperopt(p_logging=True, p_algo='RND', p_ids=None)
Bases:
HyperParamTuner
,Wrapper
,ScientificObject
This class is a ready to use wrapper class for Hyperopt framework. Objects of this type can be treated as a hyperparameter tuner object.
- Parameters:
p_logging – Log level (see constants for log levels)
p_algo (str, optional) – Selection of a hyperparameter tuning algorithm, default: C_ALGO_RAND
p_ids (list of str, optional) – List of hyperparameter ids to be tuned, otherwise all hyperparameters, default: None
- C_NAME
Name of the class.
- Type:
str
- C_ALGO_TPE
Refer to Tree of Parzen Estimators (TPE) algorithm.
- Type:
str
- C_ALGO_RAND
Refer to Random Grid Search algorithm.
- Type:
str
- C_NAME = 'Hyperopt'
- C_WRAPPED_PACKAGE = 'hyperopt'
- C_ALGO_TPE = 'TPE'
- C_ALGO_RAND = 'RND'
- C_SCIREF_TYPE = 'Proceedings'
- C_SCIREF_AUTHOR = 'James Bergstra, Dan Yamins, David D. Cox'
- C_SCIREF_TITLE = 'Hyperopt: A Python Library for Otimizing the Hyperparameters of Machine Learning Algorithms'
- C_SCIREF_CONFERENCE = 'Proceedings of the 12th Python in Science Conference'
- C_SCIREF_YEAR = '2013'
- C_SCIREF_PAGES = '13-19'
- C_SCIREF_DOI = '10.25080/Majora-8b375195-003'
- C_SCIREF_EDITOR = 'Stefan van der Walt, Jarrod Millman, Katy Huff'
- C_LOG_SEPARATOR = '------------------------------------------------------------------------------'
- _maximize() TrainingResults
This method is a place to setup a hp tuner based on hp structure of the model and run the hp tuner.
- Returns:
best_result – The best result after a number of evaluations.
- Return type:
float
- _ofct_hyperopt(p_params)
This method is a place to run the evaluations by getting next set of hps from the tuner, inducting hps to the model, and running the the objective function.
- Returns:
result – The result of an evaluations.
- Return type:
float
- setup_spaces()
This method is used to setup the hyperparameter spaces, including the tuning boundaries and a suitable discrete value. The hyperparameter should be bounded both above and below. We are using the “quantized” continuous distributions for natural and integer numbers. Meanwhile the real numbers are not quantized. For different parameter expressions, please redefined this method and check http://hyperopt.github.io/hyperopt/getting-started/search_spaces/! For big data handling, please redifined this method!
- Returns:
spaces – List of parameter expressions.
- Return type:
list
Cross References