mlektic.methods.base package

Submodules

mlektic.methods.base.regularizers module

class mlektic.methods.base.regularizers.Regularizers[source]

Bases: object

A class that provides static methods for various types of regularization.

l1(lambda_value: float) -> Callable[[tf.Tensor], tf.Tensor]

Returns a function that computes the L1 regularization term for a given tensor of weights.

l2(lambda_value: float) -> Callable[[tf.Tensor], tf.Tensor]

Returns a function that computes the L2 regularization term for a given tensor of weights.

elastic_net(lambda_value: float, alpha: float) -> Callable[[tf.Tensor], tf.Tensor]

Returns a function that computes the Elastic Net regularization term for a given tensor of weights.

static elastic_net(lambda_value: float, alpha: float)[source]

Returns a function that computes the Elastic Net regularization term for a given tensor of weights.

Parameters:
  • lambda_value (float) – The regularization parameter.

  • alpha (float) – The mixing parameter between L1 and L2 regularization, with 0 <= alpha <= 1.

Returns:

A function that takes a tensor of weights as input and returns the Elastic Net regularization term.

Return type:

Callable[[tf.Tensor], tf.Tensor]

static l1(lambda_value: float)[source]

Returns a function that computes the L1 regularization term for a given tensor of weights.

Parameters:

lambda_value (float) – The regularization parameter.

Returns:

A function that takes a tensor of weights as input and returns the L1 regularization term.

Return type:

Callable[[tf.Tensor], tf.Tensor]

static l2(lambda_value: float)[source]

Returns a function that computes the L2 regularization term for a given tensor of weights.

Parameters:

lambda_value (float) – The regularization parameter.

Returns:

A function that takes a tensor of weights as input and returns the L2 regularization term.

Return type:

Callable[[tf.Tensor], tf.Tensor]

Module contents