Class L1WeightDecay


public class L1WeightDecay extends Loss
L1WeightDecay calculates L1 penalty of a set of parameters. Used for regularization.

L1 loss is defined as \(L1 = \lambda \sum_i \vert W_i\vert\).

  • Constructor Details

    • L1WeightDecay

      public L1WeightDecay(NDList parameters)
      Calculates L1 weight decay for regularization.
      Parameters:
      parameters - holds the model weights that will be penalized
    • L1WeightDecay

      public L1WeightDecay(String name, NDList parameters)
      Calculates L1 weight decay for regularization.
      Parameters:
      name - the name of the penalty
      parameters - holds the model weights that will be penalized
    • L1WeightDecay

      public L1WeightDecay(String name, NDList parameters, float lambda)
      Calculates L1 weight decay for regularization.
      Parameters:
      name - the name of the penalty
      parameters - holds the model weights that will be penalized
      lambda - the weight to apply to the penalty value, default 1
  • Method Details

    • evaluate

      public NDArray evaluate(NDList label, NDList prediction)
      Calculates the evaluation between the labels and the predictions.
      Specified by:
      evaluate in class Evaluator
      Parameters:
      label - the correct values
      prediction - the predicted values
      Returns:
      the evaluation result