pymor.algorithms.ml.base_estimator¶
Module Contents¶
- class pymor.algorithms.ml.base_estimator.BaseEstimator[source]¶
Bases:
pymor.core.base.BasicObjectBase-class for scikit-learn-style estimators.
This class provides the
get_paramsandset_paramsmethods required to use the hyperparameter tuning methods of scikit-learn. In order to make use of the functionality, an inheriting regressor only needs to provide a tuple of init-parameters as strings (the_paramsclass-attribute). If the regressor also contains another object with hyperparameters that might be adjusted, the_nested_objectstring referring to that attribute can be set. Special parameter handling can further be implemented by overriding the_get_extra_paramsand_set_extra_parammethods, respectively. This class cannot be used directly but serves as a base class for other regressors.Methods
Returns a dict of the init-parameters of the estimator, together with their values.
Set the parameters of the estimator and the nested object.
- get_params(deep=True)[source]¶
Returns a dict of the init-parameters of the estimator, together with their values.
The argument
deep=Trueis required to match the scikit-learn interface.- Parameters:
deep – If
True, the parameters for this estimator and for the nested object (kernel, neural network, etc.) will be returned.- Returns:
A dictionary of parameters and respective values of the estimator.
- set_params(**params)[source]¶
Set the parameters of the estimator and the nested object.
Supports nested parameter setting for the nested object using the value of
self._nested_objectas prefix.- Parameters:
params – Estimator parameters to set.
- Returns:
An instance of the estimator with the new parameters.