nemos.regularizer.Lasso#
- class nemos.regularizer.Lasso[source]#
Bases:
RegularizerRegularizer class for Lasso (L1 regularization).
This class equips models with the Lasso proximal operator and the Lasso penalized loss function.
Attributes
- __init__()#
Methods
__init__()allow_solver(algo_name)Add an algorithm to the list of compatible solvers.
check_solver(solver_name)Raise an error if the given solver is not allowed.
get_params([deep])From scikit-learn, get parameters by inspecting init.
get_proximal_operator(params, strength)Retrieve the proximal operator.
penalized_loss(loss, params, strength)Return a function for calculating the penalized loss.
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
- classmethod allow_solver(algo_name)#
Add an algorithm to the list of compatible solvers.
- check_solver(solver_name)#
Raise an error if the given solver is not allowed.
- 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(params, strength)#
Retrieve the proximal operator.
- penalized_loss(loss, params, strength)#
Return a function for calculating the penalized loss.
- 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 (
Any) – Estimator parameters.- Returns:
self – Estimator instance.
- Return type:
estimator instance