Class ElasticNetWeightDecay


public class ElasticNetWeightDecay extends Loss
ElasticWeightDecay calculates L1+L2 penalty of a set of parameters. Used for regularization.

L loss is defined as \(L = \lambda_1 \sum_i \vert W_i\vert + \lambda_2 \sum_i {W_i}^2\).

  • Constructor Details

    • ElasticNetWeightDecay

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

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

      public ElasticNetWeightDecay(String name, NDList parameters, float lambda)
      Calculates Elastic Net 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 (both L1 and L2)
    • ElasticNetWeightDecay

      public ElasticNetWeightDecay(String name, NDList parameters, float lambda1, float lambda2)
      Calculates Elastic Net weight decay for regularization.
      Parameters:
      name - the name of the penalty
      parameters - holds the model weights that will be penalized
      lambda1 - the weight to apply to the L1 penalty value, default 1
      lambda2 - the weight to apply to the L2 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