difficulty 2/5
R²
How much better a model predicts than simply always guessing the mean — the one regression score that is comparable across different datasets.
Intuition
MSE, RMSE and MAE all carry the target's units, so none of them can tell you whether a score is good. An RMSE of 3 is excellent for one problem and useless for another.
R² fixes this by comparing your model against a baseline that always exists: predicting the mean of the target, every time. R² is the fraction of the baseline's error that your model eliminated. That makes it unitless. It does not make it comparable across datasets: the baseline is each dataset's own variance, and "as such variance is dataset dependent, R² may not be meaningfully comparable across different datasets" [4, §3.4.6.1].
Formal definition
How it works
Where it's used
Why & when
Worked example
Pitfalls
Check yourself
3 questions
The questions on this page come with access. They are graded on the server, so the answers stay there until you have given yours.
On the cheat sheet: Regression metrics and losses →
Sources
- scikit-learn — sklearn.metrics.r2_scoredocs · retrieved 2026-08-30https://scikit-learn.org/stable/modules/generated/sklearn.metrics.r2_score.html
- e-Handbook of Statistical Methods — 4.4.4 How can I tell if a model fits my data?standard · retrieved 2026-10-04https://www.itl.nist.gov/div898/handbook/pmd/section4/pmd44.htm
- Think Stats — 10. Linear least squaresbook · retrieved 2026-10-04https://greenteapress.com/thinkstats2/html/thinkstats2011.html
- scikit-learn User Guide — Metrics and scoringdocs · retrieved 2026-10-06https://scikit-learn.org/stable/modules/model_evaluation.html
- Dive into Deep Learning — 3.6 Generalizationbook · retrieved 2026-10-06https://d2l.ai/chapter_linear-regression/generalization.html