Class Specificity

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

public class Specificity extends Object implements ClassificationMetric
Specificity (SPC) or True Negative Rate is a statistical measures of the performance of a binary classification test. Specificity measures the proportion of negatives which are correctly identified.
     SPC = TN / N = TN / (FP + TN) = 1 - FPR
 
Sensitivity and specificity are closely related to the concepts of type I and type II errors. For any test, there is usually a trade-off between the measures. This trade-off can be represented graphically using an ROC curve.

In this implementation, the class label 1 is regarded as positive and 0 is regarded as negative.

See Also:
  • Field Details

    • instance

      public static final Specificity instance
      Default instance.
  • Constructor Details

    • Specificity

      public Specificity()
  • 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 specificity.
      Parameters:
      truth - the ground truth.
      prediction - the prediction.
      Returns:
      the metric.
    • toString

      public String toString()
      Overrides:
      toString in class Object