What is Specificity?
Specificity is the proportion of actual negative examples that a classifier correctly predicts as negative, calculated as `TN/(TN+FP)` and also called the True Negative Rate.
Quick Facts
| Specification | Official Specification |
|---|
How It Works
Define the negative class and denominator
Specificity requires a declared negative class and at least one actual negative example. If TN+FP is zero, the result is undefined rather than zero or one. Current scikit-learn Recall semantics can compute Specificity by treating the negative class as the target label, but the report must still name that label and the zero-division policy.
Evaluate the sensitivity-specificity tradeoff
Raising the positive threshold usually increases Specificity by reducing false positives while decreasing Sensitivity by missing more positives. The best operating point depends on the cost of false alarms, the cost of misses, review capacity, and any minimum safety constraint. A False Positive Rate target is equivalent to a Specificity target only when both use the same labels, population, and threshold.
Use one-versus-rest carefully in multiclass tasks
For one class, multiclass Specificity treats every other class as negative. Large rest groups can make the rate look excellent while the target class or one costly class pair performs badly. Publish the full Confusion Matrix and per-class results. When prevalence, label verification, or eligibility changes, recompute the metric rather than treating historical Specificity as a permanent model property.
Key Characteristics
- Measures true negatives divided by all actual negatives
- Equals one minus the False Positive Rate under the same contract
- Depends on the declared negative class and decision threshold
- Is undefined when the evaluation sample has no actual negatives
- Can reach one for a classifier that predicts every example negative
- Needs Sensitivity, counts, uncertainty, and decision costs for context
Common Use Cases
- Limiting false blocks of legitimate transactions or messages
- Controlling unnecessary follow-up tests after a screening model
- Setting a maximum false-alarm rate for security detection
- Comparing thresholds under a finite manual-review capacity
- Auditing negative-class performance across deployment slices
Example
Loading code...Frequently Asked Questions
How is Specificity calculated?
Divide true negatives by all actual negatives: `TN/(TN+FP)`. Publish the negative-class definition, raw counts, threshold, sample weighting, outcome window, and uncertainty. If there are no actual negatives, Specificity is undefined.
What is the difference between Specificity and Precision?
Specificity conditions on actual negatives and asks how many were correctly rejected. Precision conditions on positive predictions and asks how many were truly positive. Their denominators differ, and Precision is directly affected by class prevalence.
What is the relationship between Specificity and false-positive rate?
Under the same labels, weights, population, and threshold, `Specificity=1-FPR`. Specificity reports correctly rejected negatives; FPR reports actual negatives incorrectly flagged positive. Mixing results from different protocols breaks this complement.
Can a model have high Specificity and still be useless?
Yes. Predicting every example negative produces no false positives and therefore perfect Specificity, but it misses every positive. Pair Specificity with Recall or Sensitivity, Precision, raw alert volume, and the costs of both errors.
How is Specificity used in multiclass classification?
For a selected class, treat that class as positive and all other classes as negative, then compute the true-negative rate. Repeat per class and retain the full multiclass Confusion Matrix because a large rest group can hide one costly class-to-class error.