Skip to content
BENIBIX Learn

R-Squared

AI📏 Evaluation & BenchmarksRegression Metrics

Also known as R², Coefficient of Determination, R2 Score

A score for models that guess numbers. 1 is perfect, and 0 is no better than the average.

Think of it like

It is like a grade for how well a line follows the dots. A full mark means it hits every dot.

Example

Lucy's model guesses flat prices from size and street. It gets an R-squared of 0.75, so it explains about three quarters of why the prices differ.

Why it matters

It has no units, so you can compare models on one task at a glance. It also shows if a model beats the simplest guess.

Formula

R² = 1 - (sum of squared errors ÷ sum of squared gaps from the mean)

Definition

R-squared tells you how much of the ups and downs in a number a model explains. It compares the model's errors with a plain guess that always says the average. A score of 1 means the model gets every value right. A score of 0 means it does no better than the average. On new data, it can even drop below 0, which means it does worse than the average. It is often written R² and read as a share, so 0.8 is 80%.
R-squared asks how much smaller the gaps are than the gaps to a flat line at the average.

Common mistake

Trusting a high R-squared from the training data. Check it on a test set, or an overfit model will look great.

Key takeaways

  1. 1
    Beat the average. 0 means no better than the mean.
  2. 2
    1 is perfect. Every value matched.
  3. 3
    No units. Easy to compare on one task.