Class L2Loss


public class L2Loss extends Loss
Calculates L2Loss between label and prediction, a.k.a. MSE(Mean Square Error).

L2 loss is defined by \(L = \frac{1}{2} \sum_i \vert {label}_i - {prediction}_i \vert^2\)

  • Constructor Details

    • L2Loss

      public L2Loss()
      Calculate L2Loss between the label and prediction, a.k.a. MSE(Mean Square Error).
    • L2Loss

      public L2Loss(String name)
      Calculate L2Loss between the label and prediction, a.k.a. MSE(Mean Square Error).
      Parameters:
      name - the name of the loss
    • L2Loss

      public L2Loss(String name, float weight)
      Calculates L2Loss between the label and prediction, a.k.a. MSE(Mean Square Error).
      Parameters:
      name - the name of the loss
      weight - the weight to apply on loss value, default 1/2
  • 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