Course contentsShow
← Machine Learning and Deep Learning
Lesson 196 of 3,5383. Linear RegressionFree lesson

Coefficient of Determination (R²)

Interpreting R² as proportion of variance explained and what values indicate about model fit quality.

Coefficient of Determination (R²)

What you'll learn: How to interpret R² as a measure of how well your linear regression model explains the variance in your data.

What R² Tells You

After fitting a linear regression model, you need to know: how good is this fit? The Coefficient of Determination, written as R² (R-squared), answers this question by measuring what proportion of the variance in your target variable is explained by your model.

Think of variance as "how spread out" your data points are. R² compares two things:

  1. How much your predictions reduce uncertainty compared to just guessing the mean
  2. The total uncertainty in your data

Understanding R² Values

R² ranges from 0 to 1 (sometimes negative for terrible models):

  • R² = 1.0: Perfect fit! Your model explains 100% of the variance. Every prediction is exactly right.
  • R² = 0.75: Your model explains 75% of the variance. Pretty good—most variation is captured.
  • R² = 0.5: Your model explains half the variance. There's room for improvement.
  • R² = 0.0: Your model is no better than predicting the mean every time.
  • R² < 0: Your model is worse than just using the mean. Something went very wrong!

Practical Interpretation

If you're predicting house prices and get R² = 0.82, it means your model (using square footage, bedrooms, etc.) explains 82% of why prices vary. The remaining 18% is due to factors your model doesn't capture—maybe location nuances or renovations.

Key Takeaway: R² measures the proportion of variance your model explains, ranging from 0 (no better than the mean) to 1 (perfect predictions), helping you quantify model fit quality before making decisions about whether your linear regression is good enough.