R² Score (Coefficient of Determination)
What you'll learn: How R² measures the proportion of variance your regression model explains, and why it isn't always what it seems.
What Is R²?
R² (pronounced "R-squared") tells you how much of the variability in your target variable is explained by your model. It answers: "Is my model capturing the patterns in the data, or am I just as well off predicting the mean every time?"
Think of it like a quiz score. If your model gets R² = 0.8, it explains 80% of the variance—your predictions follow the real patterns quite well. If R² = 0, your model is no better than simply guessing the average value every time.
Understanding the Range
- R² = 1: Perfect predictions (all variance explained)
- R² = 0: Your model performs like predicting the mean
- R² < 0: Your model is worse than predicting the mean—yes, this is possible!
Calculation (Conceptually)
R² compares two things:
- How wrong your model is (sum of squared errors from your predictions)
- How wrong you'd be just guessing the mean (total variance)
The formula essentially asks: "How much better are you than the baseline?"
Interpretation Pitfalls
⚠️ R² can be misleading:
- Adding any feature increases R² (even irrelevant ones)—use adjusted R² for multiple features
- Negative R² means your model is fundamentally flawed
- High R² doesn't prove causation or mean predictions are accurate on new data
- R² alone doesn't tell you if MSE or MAE meet your requirements
Key Takeaway: R² measures the proportion of variance explained (from -∞ to 1), but beware—it can increase with useless features and doesn't guarantee good real-world performance.