src.utils.tuning.hyper_random_search
Classes
|
- class src.utils.tuning.hyper_random_search.HyperRandomSearch(**kwargs)
- Author:
Alberto M. Esmoris Pena
Class to apply random search on the hyperparameter space of a model.
- Variables:
nthreads (int) – Number of threads to run parallel grid search nodes. Note that the model might have nthreads too. In this case, it is important that the number of threads from the grid search and the number of threads from the model itself are considered together.
num_folds (int) – Number of folds to train and validate the model on a kfolding scheme for each node in the grid search.
iterations (int) – The number of iterations. Each iteration will randomly select values from the random distributions to test a model.
distributions (dict) – Dictionary which elements are dictionaries that define a particular distribution to generate random values for a concrete hyperparameter.
pre_dispatch (int or str) – How many jobs are dispatched during the parallel execution. It can be useful to prevent dispatching more jobs than those that can be processed by the CPUs.
- static extract_tuner_args(spec)
Extract the arguments to initialize/instantiate an HyperRandomSearch from a key-word specification.
- Parameters:
spec – The key-word specification containing the arguments.
- Returns:
The arguments to initialize/instantiate an HyperRandomSearch.
- __init__(**kwargs)
Initialize/instantiate an HyperRandomSearch.
- Parameters:
kwargs – The attributes for the HyperRandomSearch
- tune(model, pcloud=None)
Tune the given model with the best configuration found after computing a random search on the model’s hyperparameters space. See
HyperTunerandTuner. Also, seetuner.Tuner.tune()- Parameters:
model – The model which hyperparameters must be tuned.
pcloud – The input point cloud (cannot be None)
- static build_distributions(distributions)
Transform the specified distributions instantiating the corresponding objects to represent random distributions.
- Parameters:
distributions – The specification of the distributions.
- Returns:
The built distributions.