HeadlinesBriefing favicon HeadlinesBriefing.com

R-Squared Explained: Why Negative Scores Mean Your Model Is Harmful

DEV Community •
×

R-squared measures how much better your model is than just predicting the average every time. A score of 1 means perfect predictions, while 0 means you're no better than guessing the mean. A negative R² indicates your model is actively harmful—worse than doing nothing at all.

This metric answers a critical question: is your model adding value or just adding noise? It's calculated by comparing your model's squared errors to the baseline's squared errors. A positive score means you're explaining some variance, while a negative score means you're adding error compared to the simple average prediction.

Negative R² typically signals fundamental problems like overfitting, using the wrong model type for your data, or catastrophic feature engineering errors. It's a diagnostic tool that tells you when to scrap your approach entirely. In production, a negative R² means you should revert to the baseline and re-evaluate your entire pipeline.