Class HingeLoss


public class HingeLoss extends Loss
HingeLoss is a type of Loss.

Hinge loss is defined by: \(L = \sum_i max(0, margin - pred_i \cdot label_i)\)

  • Constructor Details

    • HingeLoss

      public HingeLoss()
      Calculates Hinge loss.
    • HingeLoss

      public HingeLoss(String name)
      Calculates Hinge loss.
      Parameters:
      name - the name of the loss
    • HingeLoss

      public HingeLoss(String name, int margin, float weight)
      Calculates Hinge loss.
      Parameters:
      name - the name of the loss
      margin - the margin in hinge loss. Defaults to 1.0
      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