Specificity
Of all actual negatives, the fraction correctly identified.
Formula
Live Calculator
MembersVariables
Example
TN=90, FP=10: Specificity = 0.90
How it works
Specificity measures how well a model avoids false alarms among the cases that are truly negative. It is calculated as TN divided by all actual negatives (TN + FP), so it answers: "If the true class is negative, how often does the model correctly say negative?" This works because the denominator counts every actual negative case, while the numerator counts only the ones the model got right.
When to use it
Use specificity when false positives matter, such as in medical screening, fraud detection, spam filtering, or any test where incorrectly flagging a negative case has a cost. It is especially useful when you want to know how reliably a model leaves normal or non-target cases alone.
Worked example, step by step
Suppose a diagnostic model is tested on 200 people who do not have the condition. Of these, 170 are correctly predicted as negative (TN = 170). The model incorrectly labels 30 healthy people as positive (FP = 30). Specificity = TN / (TN + FP) Specificity = 170 / (170 + 30) Specificity = 170 / 200 Specificity = 0.85 So, the model's specificity is 0.85, or 85%.
Common mistakes to avoid
- Using true positives instead of true negatives in the numerator
- Dividing by all predictions instead of only actual negatives
- Confusing specificity with sensitivity, which measures how well positives are detected
Did You Know?
Specificity is the true negative rate, complementary to recall.
Share this formula
More in Data Science & ML
View allMean Squared Error (MSE)
BasicAverage of squared differences between predicted and actual values.
Root Mean Squared Error (RMSE)
BasicSquare root of MSE, in the same units as the target variable.
Mean Absolute Error (MAE)
BasicAverage of absolute differences between predictions and actual values.
Coefficient of Determination (R²)
IntermediateProportion of variance in the target explained by the model.
Classification Accuracy
BasicFraction of predictions that are correct.
Precision
IntermediateOf all positive predictions, the fraction that were correct.