Class L1Loss


public class L1Loss extends Loss
L1Loss calculates L1 loss between label and prediction.

L1 loss is defined by \(L = \sum_i \vert {label}_i - {prediction}_i \vert\).

  • Constructor Details

    • L1Loss

      public L1Loss()
      Calculates L1 Loss between the label and prediction, a.k.a. MAE(Mean Absolute Error).
    • L1Loss

      public L1Loss(String name)
      Calculates L1 Loss between the label and prediction, a.k.a. MAE(Mean Absolute Error).
      Parameters:
      name - the name of the loss
    • L1Loss

      public L1Loss(String name, float weight)
      Calculates L1 Loss between the label and prediction, a.k.a. MAE(Mean Absolute Error).
      Parameters:
      name - the name of the loss
      weight - the weight to apply on loss 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