nemos.regularizer.Ridge#

class nemos.regularizer.Ridge[source]#

Bases: Regularizer

Regularizer class for Ridge (L2 regularization).

This class equips models with the Ridge proximal operator and the Ridge penalized loss function.

Attributes

__init__()[source]#

Methods

__init__()

get_params([deep])

From scikit-learn, get parameters by inspecting init.

get_proximal_operator()

Retrieve the proximal operator for Ridge regularization (L2 penalty).

penalized_loss(loss, regularizer_strength)

Returns the penalized loss function for Ridge regularization.

set_params(**params)

Set the parameters of this estimator.

property allowed_solvers: Tuple[str]#
property default_solver: str#
get_params(deep=True)#

From scikit-learn, get parameters by inspecting init.

Parameters:

deep

Return type:

dict

Returns:

out:

A dictionary containing the parameters. Key is the parameter name, value is the parameter value.

get_proximal_operator()[source]#

Retrieve the proximal operator for Ridge regularization (L2 penalty).

Return type:

Callable[[Any, float, float], Tuple[Array, Array]]

Returns:

The proximal operator, applying L2 regularization to the provided parameters. The intercept term is not regularized.

penalized_loss(loss, regularizer_strength)[source]#

Returns the penalized loss function for Ridge regularization.

Return type:

Callable

Parameters:
  • loss (Callable)

  • regularizer_strength (float)

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