Evaluation metrics practice problems
26 problems · 0 solved
A model is only as good as the way you measure it. Evaluation metrics turn predictions into numbers you can compare, but each metric hides choices about ties, averaging and edge cases that can change the result. These problems ask you to implement the common metrics yourself so you know exactly what they reward. You will build a confusion matrix, compute precision, recall and F1, compare macro and micro F1, compute ROC AUC by counting ranked pairs, build a precision recall curve with tied scores, measure calibration with expected calibration error, compute mean reciprocal rank and NDCG at k, measure rater agreement with Cohen's kappa, estimate pass@k without bias, and score generated text with ROUGE-L and sentence BLEU. Start with the Easy problems on the confusion matrix and precision, recall and F1. Then move to AUC, ranking metrics and kappa, and finish with BLEU and average precision with ties. Choosing and explaining the right metric is a core interview skill, and in real jobs a wrong metric can make a weak model look good or a strong model look broken.
Easy 8
- Compute precision, recall and F1 from predictions
- Measure how overconfident a classifier is with expected calibration error
- Build a confusion matrix
- Compute mean reciprocal rank
- Pick a final answer by self-consistency majority vote
- Convert language model loss to bits per byte
- Compute R-squared and adjusted R-squared for a regression
- Compute the Matthews correlation coefficient for a binary classifier
Medium 11
- Compute ROC AUC by counting ranked pairs
- Grade a search ranking with NDCG at k
- Compute macro and micro F1 for a multi-class classifier
- Measure rater agreement with Cohen's kappa
- Estimate pass@k without bias
- Compute ROUGE-L F1 from the longest common subsequence
- Extract and normalise a final answer for a math verifier
- Score pairwise LLM-judge results with position swapping
- Compute exact match and token F1 for QA answers
- Compute the points of a ROC curve with tied scores
- Pick the decision threshold that maximises F1
Hard 7
- Build a precision recall curve and average precision with tied scoresPro
- Compute sentence BLEU with brevity penaltyPro
- Score multiple-choice answers by log-likelihoodPro
- Evaluate perplexity of a long text with a strided sliding windowPro
- Batch LM cross-entropy with ignore index, perplexity and gradientPro
- Calibrate classifier scores with Platt scalingPro
- Compare two clusterings with the adjusted Rand indexPro