Class L2

All Implemented Interfaces:
Regularizer

public class L2 extends L1L2
A regularizer that applies a L2 (Ridge Regression) regularization penalty.

The L2 regularization penalty is computed as: loss = l2 * reduceSum(square(x))

  • Constructor Details

    • L2

      public L2()
      Create a regularizer that applies an L2 regularization penalty of AbstractRegularizer.DEFAULT_REGULARIZATION_PENALTY and a name based on the class name.
    • L2

      public L2(String name)
      Create a regularizer that applies an L2 regularization penalty of AbstractRegularizer.DEFAULT_REGULARIZATION_PENALTY
      Parameters:
      name - the name for this AbstractRegularizer
    • L2

      public L2(float l2)
      Create a regularizer that applies an L1 regularization penalty and a name based on the class name.
      Parameters:
      l2 - the L2 regularization penalty
      Throws:
      IllegalArgumentException - if the l2 regularization factor is NaN or is infinite.
    • L2

      public L2(String name, float l2)
      Create a regularizer that applies an L1 regularization penalty
      Parameters:
      name - the name for this AbstractRegularizer
      l2 - the L2 regularization penalty
      Throws:
      IllegalArgumentException - if the l2 regularization factor is NaN or is infinite.