Class LogLoss

java.lang.Object
smile.validation.metric.LogLoss
All Implemented Interfaces:
Serializable, ProbabilisticClassificationMetric

public class LogLoss extends Object implements ProbabilisticClassificationMetric
Log loss is a evaluation metric for binary classifiers and it is sometimes the optimization objective as well in case of logistic regression and neural networks. Log Loss takes into account the uncertainty of the prediction based on how much it varies from the actual label. This provides a more nuanced view of the performance of the model. In general, minimizing Log Loss gives greater accuracy for the classifier. However, it is susceptible in case of imbalanced data.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final LogLoss
    Default instance.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static double
    of(int[] truth, double[] probability)
    Calculates the Log Loss for binary classifier.
    double
    score(int[] truth, double[] probability)
    Returns a score to measure the quality of classification.
     

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • instance

      public static final LogLoss instance
      Default instance.
  • Constructor Details

    • LogLoss

      public LogLoss()
  • Method Details

    • score

      public double score(int[] truth, double[] probability)
      Description copied from interface: ProbabilisticClassificationMetric
      Returns a score to measure the quality of classification.
      Specified by:
      score in interface ProbabilisticClassificationMetric
      Parameters:
      truth - the true class labels.
      probability - The posterior probability of positive class.
      Returns:
      the metric.
    • of

      public static double of(int[] truth, double[] probability)
      Calculates the Log Loss for binary classifier.
      Parameters:
      truth - the ground truth.
      probability - the posterior probability of positive class.
      Returns:
      Log Loss
    • toString

      public String toString()
      Overrides:
      toString in class Object