src.utils.tuning.hyper_tuner
Classes
|
- class src.utils.tuning.hyper_tuner.HyperTuner(**kwargs)
- Author:
Alberto M. Esmoris Pena
Class for model’s hyperparameters tuning.
- Variables:
report_path (str) – The path (OPTIONAL) to export the hyperparameter tuning report.
hpnames (list or tuple or np.ndarray) – The names (as strings) of the hyperparameters to be considered.
scores (str or list or dict or tuple or callable or None) – The scores that must be optimized during hyperparameter tuning (None means using the default behavior for each hyper tuner).
- static extract_tuner_args(spec)
Extract the arguments to initialize/instantiate an HyperTuner from a key-word specification.
- Parameters:
spec – The key-word specification containing the arguments.
- Returns:
The arguments to initialize/instantiate an HyperTuner.
- __init__(**kwargs)
Initialize/instantiate an HyperTuner.
- Parameters:
kwargs – The attributes for the HyperTuner.
- static search(model, search, pcloud)
Compute the search of the best hyperparameters for the given model on the given point cloud.
- Parameters:
model – The model which hyperparameters must be tuned. See
Model.search – The search object (must have a fit method to be applied on a features matrix and a vector of classes, i.e., F and y).
pcloud – The point cloud representing the input data for the search.
- Returns:
Completed search.
- static update_model(model, search, pcloud=None)
Update model from result.
- static update_model_with_no_refit(model, search, pcloud=None)
Compute the model update when the hyperparameter tuning ends without refitting the model. See
HyperTuner.update_model().
- static update_model_from_refit(model, search, pcloud=None)
Compute the model update when the hyperparameter tuning refits the model after finishing. See
HyperTuner.update_model().
- static kwargs_hyperparameters_from_spec(kwargs, spec)
Update the key-word arguments (kwargs) to derive the hyperparameters from the specification. In case there are explicitly given hyperparameters, they must match exactly with the specification.
- Parameters:
kwargs – The key-word arguments to be updated.
spec – The specification, often a dictionary contained inside the key-word arguments.
- Returns:
The updated key-word arguments.