optiml.ml.neural_network.regularizers module

class optiml.ml.neural_network.regularizers.Regularizer(lmbda=0.0)[source]

Bases: ABC

Base abstract class for all regularizers. A regularizer penalizes the magnitude of the parameters and exposes both its function and its jacobian.

Parameters:

lmbda (float, default=0.) – Regularization strength. The higher the value, the stronger the penalty on the parameters.

function(theta)[source]
jacobian(theta)[source]
class optiml.ml.neural_network.regularizers.L1(lmbda=0.0)[source]

Bases: Regularizer

L1 (Lasso) regularizer:

\[R(\theta) = \lambda \sum \lvert \theta \rvert\]
Parameters:

lmbda (float, default=0.) – Regularization strength.

function(theta)[source]
jacobian(theta)[source]
class optiml.ml.neural_network.regularizers.L2(lmbda=0.0)[source]

Bases: Regularizer

L2 (Ridge) regularizer:

\[R(\theta) = \lambda \sum \theta^2\]
Parameters:

lmbda (float, default=0.) – Regularization strength.

function(theta)[source]
jacobian(theta)[source]