How-to articleMethodology & analyticsComputer science

Choosing and reporting evaluation metrics in a machine learning dissertation

The right metric reflects the decision a model supports. This article explains regression and classification metrics, corrects common misconceptions about RMSE and accuracy, adds precision-recall curves and calibration, and sets out what to report.

What you will learn

  • Distinguish loss functions from evaluation metrics, and discrimination from calibration
  • Choose between MAE, RMSE and scaled errors for regression and forecasting
  • Choose classification metrics for balanced and imbalanced data
  • Set and justify a decision threshold from error costs
  • Design an evaluation that avoids leakage and optimistic estimates
  • Report metrics, uncertainty and baselines in a dissertation

What you will unlearn

  • RMSE is less sensitive to outliers than MSE.RMSE is the square root of MSE, ranks models identically and is equally sensitive to large errors.
  • High accuracy means a good classifier.With rare positives, a model that predicts only the majority class can have higher accuracy than a useful one.
  • ROC AUC tells you everything about a classifier.It summarises ranking only; it ignores prevalence, the chosen threshold and calibration.
  • Low precision means the hyperparameters are wrong.Low precision often reflects rare positives and the chosen threshold, not a tuning failure.

Skills you will practise

  • Metric selection
  • Confusion matrix analysis
  • Threshold setting
  • Calibration assessment
  • Validation design
  • Reporting model performance

Start from the decision, not the metric

Machine learning dissertations are often judged on a single number, and examiners are wary of it. A metric is a summary of how a model's predictions compare with reality, and every summary hides something. The right metric is the one that reflects what the predictions will be used for: who acts on them, what a false alarm costs and what a missed case costs.

Two distinctions help. First, a loss function is what the algorithm minimises during training (for example, cross-entropy or squared error), while an evaluation metric is what you report to judge the trained model. They need not be the same. Second, metrics measure different properties: discrimination (does the model rank or separate cases correctly?), calibration (are its predicted probabilities right?) and error size (how far off are numerical predictions?). A complete evaluation usually needs more than one of these (Huang et al., 2021; Van Calster et al., 2019).

Choosing performance metrics for a machine learning study
Figure 1. Choosing performance metrics for a machine learning study.

Metrics for regression and forecasting

Mean absolute error (MAE) is the average size of the errors, in the units of the outcome. It treats all errors in proportion and is less influenced by a few large errors than squared measures. It is differentiable everywhere except at zero error, which matters for training but not for reporting.

Mean squared error (MSE) squares each error before averaging, so large errors weigh heavily. Root mean squared error (RMSE) is its square root. RMSE returns the error to the original units, which makes it easier to interpret, but it ranks models exactly as MSE does and is just as sensitive to large errors.

Worked example (illustrative). Model A makes errors of 1, 1, 1, 1 and 10 units; model B makes five errors of 2.8. Both have an MAE of 2.8. Model A's RMSE is about 4.56, while model B's is 2.8. RMSE prefers B because it penalises the single large miss; MAE sees no difference. Which is right depends on whether one large error matters more than several small ones in your application.

R2 is the proportion of variance in the outcome explained by the model. On new data it can be negative, meaning the model does worse than predicting the mean. Adjusted R2 penalises extra predictors in linear regression but is not a substitute for evaluation on held-out data. In forecasting, error measures that depend on the scale of the data cannot be compared across series, and percentage errors break down near zero; scaled errors such as MASE avoid both problems (Hyndman & Athanasopoulos, 2021).

Metrics for classification

For a binary classifier, every prediction falls into one cell of the confusion matrix: true positive (TP), false positive (FP), false negative (FN) or true negative (TN). Most classification metrics are ratios of these cells, which is why the confusion matrix itself should always be reported.

Table 1. Common classification metrics and when to use them
MetricFormula or meaningUse it whenCaution
Accuracy(TP + TN) / all casesClasses are balanced and errors cost the sameMisleading when positives are rare
PrecisionTP / (TP + FP)False alarms are costlyDepends on prevalence and threshold
Recall (sensitivity)TP / (TP + FN)Missed cases are costlyCan be raised by flagging everything
SpecificityTN / (TN + FP)Correctly clearing negatives mattersLooks high whenever negatives dominate
F1 scoreHarmonic mean of precision and recallYou need one number for the positive classIgnores true negatives; weights P and R equally
Balanced accuracyMean of recall and specificityClasses are imbalancedStill threshold-dependent
ROC AUCProbability a random positive is ranked above a random negativeComparing ranking across thresholdsIgnores prevalence and calibration
PR AUC (average precision)Area under the precision-recall curvePositives are rareBaseline equals prevalence, so compare with it
Brier score and calibration plotAccuracy of predicted probabilitiesProbabilities will be used for decisionsNeeds enough events to estimate

Precision and recall trade off against each other as the decision threshold moves. Low precision does not by itself mean poor hyperparameters: with rare positives, even a good model will raise many false alarms at a threshold that catches most cases. Choose and justify the threshold from the costs of each error, and report results at that threshold as well as across thresholds.

ROC curves can look reassuring when positives are rare, because the large number of true negatives keeps the false positive rate low. Precision-recall curves show the problem more clearly in such data (Saito & Rehmsmeier, 2015). If your model's probabilities will be used directly, for example as a risk score, report calibration too: a model can rank cases well and still give badly wrong probabilities (Van Calster et al., 2019). Benchmark studies in applied fields routinely report several metrics for this reason (Lessmann et al., 2015).

More than two classes

With several classes, precision, recall and F1 are computed per class and then averaged. A macro average gives each class equal weight, so rare classes count as much as common ones; a weighted average weights classes by their size and can hide poor performance on small classes; a micro average pools all decisions and, for single-label problems, equals accuracy. State which average you report and show per-class results in an appendix, since a good average can conceal a class the model never gets right.

Worked example: a rare outcome (illustrative)

A dissertation builds a model to flag fraudulent transactions. The test set has 10,000 transactions, of which 100 (1%) are fraudulent. The model flags 300 transactions and catches 80 of the frauds.

Table 2. Confusion matrix for the illustrative fraud model
Predicted fraudPredicted genuine
Actual fraud (100)TP = 80FN = 20
Actual genuine (9,900)FP = 220TN = 9,680
  • Accuracy is 0.976, yet a rule that calls every transaction genuine scores 0.990. Accuracy alone would favour the useless rule.
  • Recall is 0.80 and precision is about 0.27: the model finds most frauds, but nearly three in four alerts are false. F1 is 0.40.
  • Specificity is about 0.978 and balanced accuracy about 0.889.

The useful report here is recall and precision at the chosen threshold, the PR curve with its baseline of 0.01, and a sentence on what 220 false alerts would mean for the investigators who must check them.

A metric is only as good as the evaluation design

The same metric can be honest or badly inflated depending on how it was computed. Three problems recur in doctoral work. First, leakage: information from the test set reaches training through preprocessing, feature selection or duplicated records, a problem found across many fields (Kapoor & Narayanan, 2023). Second, tuning on the test set: if hyperparameters are chosen by the same cross-validation used to report performance, the estimate is optimistic, and nested cross-validation or a separate held-out set is needed (Varma & Simon, 2006). Third, ignoring time: for time-ordered data, random splits let the model learn from the future, so use forward-chaining or blocked designs (Bergmeir & Benítez, 2012). Security datasets add sampling bias and unrealistic base rates (Arp et al., 2022).

Report uncertainty as well as point estimates, for example with confidence intervals from bootstrapping or the spread across cross-validation folds, and compare against simple baselines such as the majority class or a linear model.

What to report

Table 3. Reporting checklist for model evaluation in a dissertation
ElementWhat to state
PurposeThe decision the model supports and the cost of each type of error
Data splitHow training, validation and test sets were formed (random, grouped or by time)
Primary metricChosen before analysis, with the reason
Secondary metricsConfusion matrix, precision and recall, PR or ROC curves, calibration, or MAE and RMSE as relevant
ThresholdHow it was chosen, and results at that threshold
UncertaintyConfidence intervals or variation across folds or seeds
BaselinesSimple comparators and earlier published models
ReproducibilityCode, seeds, versions and split files (Pineau et al., 2021)

For clinical prediction models, follow TRIPOD+AI, which asks for discrimination, calibration and clinical usefulness to be reported (Collins et al., 2024). Other fields have their own guidelines; check what your target journal expects.

Common mistakes

  • Reporting accuracy alone on imbalanced data.
  • Claiming that RMSE is robust to outliers.
  • Choosing the metric after seeing which one makes the model look best.
  • Reporting ROC AUC without a precision-recall view when positives are rare.
  • Treating predicted probabilities as risks without checking calibration.
  • Tuning and testing on the same data, or splitting time series at random.
  • Giving point estimates without uncertainty or a baseline.

For choosing the algorithm itself, see how to choose a machine learning algorithm for your research; for wider design pitfalls, methodology mistakes in machine learning PhDs; and for presenting results, reporting statistical results. A worked critique of a clinical model is in machine learning for early sepsis prediction.

Key takeaways

Your next step

Want to apply this to your own study?

  1. 1Tell us your topic, data and deadline
  2. 2A statistician reviews your work with you
  3. 3You get a plan and a quote
Quantitative analysis

References

  1. Arp, D., Quiring, E., Pendlebury, F., Warnecke, A., Pierazzi, F., Wressnegger, C., Cavallaro, L., & Rieck, K. (2022). Dos and don'ts of machine learning in computer security. In Proceedings of the 31st USENIX Security Symposium (pp. 3971–3988). USENIX Association. https://www.usenix.org/conference/usenixsecurity22/presentation/arp
  2. Bergmeir, C., & Benítez, J. M. (2012). On the use of cross-validation for time series predictor evaluation. Information Sciences, 191, 192-213. https://doi.org/10.1016/j.ins.2011.12.028
  3. Collins, G. S., Moons, K. G. M., Dhiman, P., Riley, R. D., Beam, A. L., Van Calster, B., Ghassemi, M., Liu, X., Reitsma, J. B., van Smeden, M., Boulesteix, A.-L., Camaradou, J. C., Celi, L. A., Denaxas, S., Denniston, A. K., Glocker, B., Golub, R. M., Harvey, H., Heinze, G., . . . Logullo, P. (2024). TRIPOD+AI statement: Updated guidance for reporting clinical prediction models that use regression or machine learning methods. BMJ, 385, e078378. https://doi.org/10.1136/bmj-2023-078378
  4. Huang, C., Li, S.-X., Caraballo, C., Masoudi, F. A., Rumsfeld, J. S., Spertus, J. A., Normand, S.-L. T., Mortazavi, B. J., & Krumholz, H. M. (2021). Performance metrics for the comparative analysis of clinical risk prediction models employing machine learning. Circulation: Cardiovascular Quality and Outcomes, 14(10), e007526. https://doi.org/10.1161/CIRCOUTCOMES.120.007526
  5. Hyndman, R. J., & Athanasopoulos, G. (2021). Forecasting: Principles and practice (3rd ed.). OTexts. https://otexts.com/fpp3/
  6. Kapoor, S., & Narayanan, A. (2023). Leakage and the reproducibility crisis in machine-learning-based science. Patterns, 4(9), 100804. https://doi.org/10.1016/j.patter.2023.100804
  7. Lessmann, S., Baesens, B., Seow, H.-V., & Thomas, L. C. (2015). Benchmarking state-of-the-art classification algorithms for credit scoring: An update of research. European Journal of Operational Research, 247(1), 124–136. https://doi.org/10.1016/j.ejor.2015.05.030
  8. Pineau, J., Vincent-Lamarre, P., Sinha, K., Larivière, V., Beygelzimer, A., d'Alché-Buc, F., Fox, E., & Larochelle, H. (2021). Improving reproducibility in machine learning research (a report from the NeurIPS 2019 reproducibility program). Journal of Machine Learning Research, 22(164), 1–20. https://www.jmlr.org/papers/v22/20-303.html
  9. Saito, T., & Rehmsmeier, M. (2015). The precision-recall plot is more informative than the ROC plot when evaluating binary classifiers on imbalanced datasets. PLoS ONE, 10(3), e0118432. https://doi.org/10.1371/journal.pone.0118432
  10. Van Calster, B., McLernon, D. J., van Smeden, M., Wynants, L., & Steyerberg, E. W. (2019). Calibration: The Achilles heel of predictive analytics. BMC Medicine, 17, 230. https://doi.org/10.1186/s12916-019-1466-7
  11. Varma, S., & Simon, R. (2006). Bias in error estimation when using cross-validation for model selection. BMC Bioinformatics, 7, 91. https://doi.org/10.1186/1471-2105-7-91

How to cite this article

Choose your referencing style, then copy. Check your university's or journal's guide for local variations.

PhD Research Lab Academy. (2021, November 2). Choosing and reporting evaluation metrics in a machine learning dissertation. PhD Research Lab. https://www.phdassistance.com/blog/how-to-identify-right-performance-evaluation-metrics-in-machine-learning-based-dissertation/

PhD Research Lab Academy. “Choosing and Reporting Evaluation Metrics in a Machine Learning Dissertation.” PhD Research Lab, 2 Nov. 2021, www.phdassistance.com/blog/how-to-identify-right-performance-evaluation-metrics-in-machine-learning-based-dissertation. Accessed [access date].

PhD Research Lab Academy (2021) Choosing and reporting evaluation metrics in a machine learning dissertation. PhD Research Lab. Available at: https://www.phdassistance.com/blog/how-to-identify-right-performance-evaluation-metrics-in-machine-learning-based-dissertation/ (Accessed: [access date]).

PhD Research Lab Academy. “Choosing and Reporting Evaluation Metrics in a Machine Learning Dissertation.” PhD Research Lab. November 2, 2021. https://www.phdassistance.com/blog/how-to-identify-right-performance-evaluation-metrics-in-machine-learning-based-dissertation.

PhD Research Lab Academy, ‘Choosing and Reporting Evaluation Metrics in a Machine Learning Dissertation’ (PhD Research Lab, 2 November 2021) <https://www.phdassistance.com/blog/how-to-identify-right-performance-evaluation-metrics-in-machine-learning-based-dissertation> accessed [access date].

PhD Research Lab Academy. Choosing and reporting evaluation metrics in a machine learning dissertation [Internet]. PhD Research Lab; 2021 Nov 2 [cited [access date]]. Available from: https://www.phdassistance.com/blog/how-to-identify-right-performance-evaluation-metrics-in-machine-learning-based-dissertation/

PhD Research Lab Academy, “Choosing and reporting evaluation metrics in a machine learning dissertation,” PhD Research Lab, Nov. 2, 2021. [Online]. Available: https://www.phdassistance.com/blog/how-to-identify-right-performance-evaluation-metrics-in-machine-learning-based-dissertation. [Accessed: [access date]].

@online{how_to_identify_right_performance_evaluation_metrics_in_machine_learning_based_dissertation_2021,
  author = {{PhD Research Lab Academy}},
  title = {{Choosing and reporting evaluation metrics in a machine learning dissertation}},
  organization = {PhD Research Lab},
  date = {2021-11-02},
  url = {https://www.phdassistance.com/blog/how-to-identify-right-performance-evaluation-metrics-in-machine-learning-based-dissertation},
  urldate = {[access date]}
}

This article is for learning. Use it to understand the method and cite the original sources above in your own work; do not copy or submit it as your own.

Choosing and reporting evaluation metrics in a machine learning dissertationNeed help applying it to your study?
Quantitative analysis