Class Accuracy

java.lang.Object
smile.validation.metric.Accuracy
All Implemented Interfaces:
Serializable, ToDoubleBiFunction<int[],int[]>, ClassificationMetric

public class Accuracy extends Object implements ClassificationMetric
The accuracy is the proportion of true results (both true positives and true negatives) in the population.
See Also:
  • Field Details

    • instance

      public static final Accuracy instance
      Default instance.
  • Constructor Details

    • Accuracy

      public Accuracy()
  • Method Details

    • score

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

      public static double of(int[] truth, int[] prediction)
      Calculates the classification accuracy.
      Parameters:
      truth - the ground truth.
      prediction - the prediction.
      Returns:
      the metric.
    • toString

      public String toString()
      Overrides:
      toString in class Object