jaxopt.objective.ridge_regression

jaxopt.objective.ridge_regression(params, l2reg, data)[source]

Ridge regression, i.e L2-regularized least squares.

\[\frac{1}{2n} ||XW - y||_2^2 + 0.5 \cdot \text{l2reg} \cdot ||W||_2^2\]
Parameters
  • W – parameters.

  • l2reg (float) – strenght of regularization.

  • data (Tuple[Array, Array]) – a tuple (X, y) where X is a matrix of shape (n_samples, n_features) and y is a vector of shape (n_samples,).

  • params (Array) –

Return type

float

Returns

objective value.

Example:

value = ridge_regression(W, l2reg, (X, y))