ctlearn_optimizer.optimizer¶
Module Contents¶
-
class
ctlearn_optimizer.optimizer.Optimizer(opt_config)[source]¶ Basic class for an optimizer.
Currently, only tree parzen estimators, random search, gaussian processes and genetic algorithm based optimization using Ray Tune is supported.
-
create_space_hyperparams(self)[source]¶ Create space of hyperparameters following required syntax.
Currently, only tree parzen estimators and random search spaces based on hyperopt, gaussian processes space based on skopt and genetic algorithm space based on ray.tune.automl are supported.
- Returns
space of hyperparameters following the syntax required by the optimization algorithm.
- Raises
NotImplementedError – if
self.optimization_typeis other thantree_parzen_estimators,random_search,gaussian_processesorgenetic_algorithm.
-
create_optimization_algorithm(self, hyperparameter_space)[source]¶ Create optimization algorithm for Ray Tune.
Currently, only tree parzen estimators, random search, gaussian processes and genetic algorithm based optimization using Ray Tune is supported.
- Parameters
space (dict, list or ray.tune.automl.search_space.SearchSpace) – space of hyperparameters following the syntax required by the optimization algorithm.
- Returns
Optimization algorithm for Ray Tune.
- Raises
NotImplementedError – if self.optimization_type is other than
tree_parzen_estimators,random_search,gaussian_processesorgenetic_algorithm.
-
get_ctlearn_metric_to_optimize(self, hyperparams)[source]¶ Evaluate a CTLearn model and return metric to optimize.
- Parameters
hyperparams (dict) – set of hyperparameters to evaluate provided by the optimizer.
- Returns
float – metric to optimize.
-
optimize(self, objective_function)[source]¶ Start the optimization of
objective_functionusing Ray Tune.Currently, only tree parzen estimators, random search, gaussian processes and genetic algorithm based optimization using Ray Tune is supported.
- Parameters
objective_function – function to optimize following the syntax:
def(hyperparams, reporter): ... # compute loss to optimize ... reporter(loss=loss)
- Returns
ExperimentAnalysis – object used for analyzing results from Tune
run().
-
optimize_ctlearn_model(self)[source]¶ Start the optimization of a CTLearn model using Ray Tune.
Currently, only tree parzen estimators, random search, gaussian processes and genetic algorithm based optimization using Ray Tune is supported.
- Returns
ExperimentAnalysis – object used for analyzing results from Tune
run().
-