nemos.regularizer.Ridge#
- class nemos.regularizer.Ridge[source]#
Bases:
RegularizerRegularizer class for Ridge (L2 regularization).
This class equips models with the Ridge proximal operator and the Ridge penalized loss function.
Attributes
Methods
__init__()check_solver(solver_name)Raise an error if the given solver is not allowed.
Get metadata routing of this object.
get_params([deep])From scikit-learn, get parameters by inspecting init.
get_proximal_operator([init_params])Retrieve the proximal operator for Ridge regularization (L2 penalty).
penalized_loss(loss, strength, init_params)Return a function for calculating the penalized loss using Lasso regularization.
set_params(**params)Set the parameters of this estimator.
- classmethod __init_subclass__(**kwargs)#
Set the
set_{method}_requestmethods.This uses PEP-487 [1] to set the
set_{method}_requestmethods. It looks for the information available in the set default values which are set using__metadata_request__*class attributes, or inferred from method signatures.The
__metadata_request__*class attributes are used when a method does not explicitly accept a metadata through its arguments or if the developer would like to specify a request value for those metadata which are different from the defaultNone.References
- check_solver(solver_name)#
Raise an error if the given solver is not allowed.
- Parameters:
solver_name (str)
- get_metadata_routing()#
Get metadata routing of this object.
Please check User Guide on how the routing mechanism works.
- Returns:
routing – A
MetadataRequestencapsulating routing information.- Return type:
MetadataRequest
- get_params(deep=True)#
From scikit-learn, get parameters by inspecting init.
- Parameters:
deep – If True, will return the parameters for this estimator and contained subobjects that are estimators.
- Return type:
- Returns:
A dictionary containing the parameters. Key is the parameter name, value is the parameter value.
- get_proximal_operator(init_params=None)[source]#
Retrieve the proximal operator for Ridge regularization (L2 penalty).
- penalized_loss(loss, strength, init_params)#
Return a function for calculating the penalized loss using Lasso regularization.
- set_params(**params)#
Set the parameters of this estimator.
The method works on simple estimators as well as on nested objects (such as
Pipeline). The latter have parameters of the form<component>__<parameter>so that it’s possible to update each component of a nested object.- Parameters:
**params (dict) – Estimator parameters.
- Returns:
self – Estimator instance.
- Return type:
estimator instance