ctlearn_optimizer.genetic_algorithm¶
Module Contents¶
-
ctlearn_optimizer.genetic_algorithm.gen_al_space(self)[source]¶ Create space of hyperparameters for the genetic algorithm optimizer.
This function creates the space of hyperparameter following ray.tune.automl syntax.
- Parameters
hyper_to_opt (dict) – dictionary containing the configuration of the hyperparameters to optimize. This dictionary must follow the next syntax:
hyper_to_opt = {'hyperparam_1': {'type': ..., 'range: ..., 'step': ...}, 'hyperparam_2': {'type': ..., 'range: ..., 'step': ...}, ... }
See the oficial documentation for more details.
- Returns
ray.tune.automl.search_space.SearchSpace – space of hyperparameters following the syntax required by the genetic algorithm optimizer.
Example:
hyper_top_opt = { 'cnn_rnn_dropout':{ 'type': 'uniform', 'range': [0,1]}, 'optimizer_type':{ 'type': 'choice',, 'range': ['Adadelta', 'Adam', 'RMSProp', 'SGD']}, 'layer1_filters':{ 'type': 'quniform', 'range': [16, 64], 'step': 1}}
- Raises
KeyError – if
typeis other thanuniform,quniformorchoice.