Search GimmeJob

Type at least 2 characters. Enter also searches by meaning.
QA interview question
AI, ML & LLMMiddleSpecialistTheory

How do precision, recall, F1 score and a confusion matrix guide classification testing?

Answer

The confusion matrix separates true and false positives and negatives. Precision asks how many predicted positives were correct; recall asks how many actual positives were found; F1 balances both through their harmonic mean. Choose the decision threshold and metric by the cost of each error, then inspect results by meaningful user and data segments.

Strong answer includes

  • derives metrics from the confusion matrix
  • connects thresholds to error cost
  • checks segmented performance

Practical example

For a fraud-detection model, the team sets a low decision threshold to maximize recall — catching 98 percent of actual fraud — because missing fraud (false negative) is far costlier than a false alarm. That tanks precision to 40 percent, meaning six out of ten flagged transactions are legitimate, so they add a human review step for flagged cases instead of auto-blocking. Segmented testing then reveals precision is only 20 percent for transactions under 10 dollars, a group the aggregate F1 score had been hiding.

#precision#recall#f1#confusion-matrix

Sources

Model selection and evaluationscikit-learn · Cross-validation, metrics, threshold selection and model-evaluation pitfallsCertified Tester AI Testing (CT-AI)ISTQB · AI-system quality characteristics, ML testing and use of AI in testing