
Compute classification metrics: Accuracy, Sensitivity, Specificity, Prevalence & Percent Error
Powered by classification metrics · Chemistry Tools
User Ratings:
ADVERTISEMENT
ADVERTISEMENT
When you’re evaluating a classification model, a diagnostic test, or any binary decision system, the raw numbers only tell part of the story. True Positives, False Negatives, False Positives, and True Negatives, these four values from the confusion matrix are the foundation for understanding how well your system is performing. But translating those numbers into meaningful metrics like Accuracy, Sensitivity, and Specificity takes math that’s easy to get wrong, especially when you’re comparing different models or working with imbalanced data.
This accuracy calculator pulls all the essential classification metrics together in one place. Enter your confusion matrix values, the tool computes Accuracy, Sensitivity (Recall), Specificity, Prevalence, Percent Error, Positive Predictive Value, and Negative Predictive Value. Choose between three display modes to focus on the metrics that matter most for your analysis. Whether you’re a data scientist evaluating a machine learning model, a medical researcher analyzing a diagnostic test, or a student learning about classification metrics, this calculator delivers accurate results instantly. All calculations run locally in your browser, keeping your data private.
Choose your display mode: Standard, Prevalence, or Percent Error using the buttons at the top of the section.
Enter the True Positive (TP) count, the number of cases correctly predicted as positive.
Enter the False Negative (FN) count, the number of positive cases that were missed.
Enter the False Positive (FP) count, the number of negative cases incorrectly predicted as positive.
Enter the True Negative (TN) count, the number of cases correctly predicted as negative.
Review the calculated metrics Accuracy, Sensitivity, Specificity, PPV, NPV, and your selected mode’s focus metric.
Check the interpretation for a plain-English explanation of what the results mean.
The calculator applies the standard formulas for binary classification metrics derived from the confusion matrix. Each metric provides a different perspective on model or test performance.
Formula: Accuracy = (TP + TN) / (TP + FN + FP + TN)
Accuracy is the proportion of correct predictions out of all predictions. It’s the most intuitive metric but can be misleading with imbalanced data.
Formula: Sensitivity = TP / (TP + FN)
Sensitivity (also called Recall or True Positive Rate) measures the proportion of actual positives that were correctly identified. It answers: “How good is the test at detecting the condition?”
Formula: Specificity = TN / (TN + FP)
Specificity measures the proportion of actual negatives that were correctly identified. It answers: “How good is the test at ruling out the condition?”
Formula: Prevalence = (TP + FN) / (TP + FN + FP + TN)
Prevalence is the proportion of actual positive cases in the population being studied.
Formula: Percent Error = (FP + FN) / (TP + FN + FP + TN)
Percent Error is the proportion of incorrect predictions out of all predictions — the complement of Accuracy.
Formula: Positive Predictive Value (PPV) = TP / (TP + FP)
PPV is the proportion of positive predictions that were actually correct. It answers: “When the test says positive, how often is it right?”
Formula: Negative Predictive Value (NPV) = TN / (TN + FN)
NPV is the proportion of negative predictions that were actually correct. It answers: “When the test says negative, how often is it right?”
Consider a diagnostic test evaluated on 200 patients: 85 true positives, 15 false negatives, 10 false positives, and 90 true negatives. Let’s calculate the key metrics.
Step 1: Identify the confusion matrix values
TP = 85, FN = 15, FP = 10, TN = 90
Total = 85 + 15 + 10 + 90 = 200
Step 2: Calculate Accuracy
Accuracy = (85 + 90) / 200 = 175 / 200 = 87.5%
Step 3: Calculate Sensitivity
Sensitivity = 85 / (85 + 15) = 85 / 100 = 85.0%
Step 4: Calculate Specificity
Specificity = 90 / (90 + 10) = 90 / 100 = 90.0%
Step 5: Calculate Prevalence
Prevalence = (85 + 15) / 200 = 100 / 200 = 50.0%
Step 6: Calculate Percent Error
Percent Error = (10 + 15) / 200 = 25 / 200 = 12.5%
Step 7: Calculate PPV and NPV
PPV = 85 / (85 + 10) = 85 / 95 = 89.5%
NPV = 90 / (90 + 15) = 90 / 105 = 85.7%
Interpretation: The test has good accuracy (87.5%) with slightly better specificity (90%) than sensitivity (85%). When the test says positive, it’s right 89.5% of the time. When it says negative, it’s right 85.7% of the time. The prevalence of the condition in this sample is 50%.
Accuracy is the proportion of correct predictions out of all predictions. It’s calculated as (TP + TN) / (TP + FN + FP + TN). While intuitive, accuracy can be misleading with imbalanced data.
Sensitivity (also called Recall or True Positive Rate) is the proportion of actual positives that were correctly identified. It’s calculated as TP / (TP + FN). High sensitivity means the test is good at detecting the condition.
Specificity is the proportion of actual negatives that were correctly identified. It’s calculated as TN / (TN + FP). High specificity means the test is good at ruling out the condition.
Sensitivity answers: “Of the actual positives, how many were caught?” PPV (Positive Predictive Value) answers: “Of the positive predictions, how many were right?” They measure different aspects of performance.
Prevalence is the proportion of actual positive cases in the population being studied. It’s calculated as (TP + FN) / Total. Prevalence affects PPV and NPV, higher prevalence increases PPV.
Percent Error is the proportion of incorrect predictions out of all predictions. It’s calculated as (FP + FN) / Total. It’s the complement of Accuracy.
The ideal balance depends on the application. For screening tests, higher sensitivity is often prioritized to avoid missing cases. For confirmatory tests, higher specificity is often prioritized to avoid false positives. The calculator helps you quantify the trade-off.
With imbalanced data, Accuracy can be misleading, a model that always predicts the majority class can have high accuracy but be useless. In these cases, Sensitivity, Specificity, PPV, and NPV provide a more complete picture. The calculator shows all these metrics to help you make a balanced assessment.
ADVERTISEMENT
ADVERTISEMENT