Skip to content

Commit

Permalink
Added specificity to the ClassificationMetrics
Browse files Browse the repository at this point in the history
  • Loading branch information
aldearle committed Aug 25, 2022
1 parent 9cea2d6 commit c118ccb
Showing 1 changed file with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,9 @@ public static double F1(long true_positives, long false_positives, long false_ne
final long denominator = true_positives * 2 + false_positives + false_negatives;
return denominator == 0 ? 0.0 : (double) (true_positives * 2) / denominator;
}

// Specificity is ( TN / ( TN + FP )
public static double specificity(long true_negatives, long false_positives) {
return ((double) true_negatives) / ( true_negatives + false_positives );
}
}

0 comments on commit c118ccb

Please sign in to comment.