Skip to content
DeepForgeby svx
All problems
EasyStatisticsst-405

Specificity from Counts

Problem

Specificity is TN / (TN + FP), the fraction of true negatives correctly identified. Return 0.0 when the denominator is zero.

Given the counts, return specificity.

Hint

It is recall applied to the negative class.

Test cases

case 1
in: [9,1]
expected: 0.9
case 2
in: [4,0]
expected: 1
case 3
in: [0,3]
expected: 0
Starter codePython
def specificity_from_counts(tn, fp):
    # Your code here
    pass

3 test cases · run your code against them in the editor