Explain how sensitivity and specificity are used in the context of binary classification.
Instruction: Define sensitivity and specificity and describe their importance in evaluating binary classification models.
Updated
Official answer
Sensitivity is TP/(TP+FN), the fraction of actual positives detected. Specificity is TN/(TN+FP), the fraction of actual negatives correctly rejected. Specify which class is positive and the decision threshold.
For a spam classifier with TP=80, FN=20, TN=855 and FP=45, sensitivity is 80% and specificity is 95%. Precision is different: 80/(80+45)=64%, the fraction of flagged messages that are spam. Overall accuracy is 935/1000=93.5%.
Changing the threshold generally trades missed positives against false alarms. Choose it using validation data and the costs and capacity of the application, then evaluate on a representative held-out sample. A high specificity can still yield many false alerts when negatives are common.
Report uncertainty and relevant subgroup behavior. Sensitivity and specificity condition on class, but they can still change when case mix or measurement changes; they are not immutable properties of a model. Handle undefined denominators explicitly when a sample contains no cases of one class.