Specificity
MediumMachine LearningStatisticsArray
Description
Given an array of true binary labels and an array of predicted binary labels, return the specificity (true negative rate): the fraction of actual negatives that were predicted negative, TN / (TN + FP). Round the result to 4 decimal places.
Examples
Input:
[0,0,1,1], [0,1,1,0]Output:
0.5Explanation:
Specificity looks only at the truly negative cases and reports the share of them the model correctly left negative.
Input:
[0,0,0], [0,0,0]Output:
1Explanation:
Specificity looks only at the truly negative cases and reports the share of them the model correctly left negative.
Input:
[0,0], [1,1]Output:
0Explanation:
Specificity looks only at the truly negative cases and reports the share of them the model correctly left negative.
Constraints
- •
1 ≤ length ≤ 10⁴ - •
labels are 0 or 1