Explained Variance
When you build a regression model, you’re trying to capture the “shape” of how a target value changes—without being thrown off by random noise. Explained variance is a way to ask: how much of the target’s natural spread did the model successfully account for?
What it measures
Explained variance compares the variability left in the prediction errors to the variability in the true targets. In scikit-learn, it’s computed as:
explained_variance = 1 - Var(y_true - y_pred) / Var(y_true)
If the residuals (errors) have low variance compared to the target’s variance, the score is close to 1. If your predictions don’t reduce variability at all, it’s near 0. It can go negative when the residual variance is larger than the target variance—meaning the model is worse than predicting a constant value.
How to interpret it in practice
- 1.0: predictions match the targets up to a constant shift in level (errors don’t vary).
- 0.0: predictions fail to explain any of the target’s variability.
- < 0: predictions add variability—strong sign of a bad model or data leakage/shift.
A key nuance: explained variance cares about the variance of errors, not whether predictions are systematically too high or too low. A model with a consistent bias (always $+5$) can still score well because the errors barely vary.
Why it matters (and where you’ll see it)
In tasks like house price prediction or demand forecasting, explained variance tells you whether the model captures the ups and downs that matter for planning. In scikit-learn you’ll encounter it as sklearn.metrics.explained_variance_score. If you need a metric that also penalizes bias, R² is usually the better default companion.
Explained Variance is a regression metric that measures how much of the variability in the true target values is captured by a model’s predictions, computed as 1 minus the ratio of residual variance to target variance. Values near 1 indicate predictions track the target’s variation well; 0 indicates no improvement over predicting the mean; negative values indicate worse-than-mean predictions. It matters because it summarizes predictive signal relative to noise in a scale-free way.
Think of a weather app trying to predict tomorrow’s temperature. Some of the ups and downs are real patterns (seasons, time of day), and some are just random noise. Explained Variance is a way to say how much of those temperature changes your AI model successfully accounts for.
In supervised learning for number predictions (like prices, demand, or blood pressure), it answers: “How much of what’s happening in the real data can my model explain?” Higher explained variance means predictions track the real swings better. Low explained variance means the model misses important patterns and mostly guesses around the average.