AI Glossary / Statistics and probability / Intermediate

Explained variance score

Definition

The explained variance score is a regression evaluation metric defined, for a target with positive variance, as one minus the variance of prediction errors divided by the variance of the observed target. It measures how much of the target's variability remains in the errors after their mean is removed. A key limitation is that it ignores a constant offset in predictions, so a score of one does not necessarily mean predictions are correct.

What it means

A model may follow the ups and downs of an outcome while consistently predicting too high. Explained variance can rate that model highly because a constant error has zero variance. The metric is therefore about variation in errors, not their full magnitude.
This entry concerns the named prediction metric, including scikit-learn's implementation. “Explained variance” also appears in principal component analysis and other settings, where the calculation and interpretation are different.

How it works

For matched observed values y_i and predictions ŷ_i, calculate errors e_i = y_i − ŷ_i. Compute the variance of y and the variance of e using consistent weighting and normalization. With positive target variance, the score is EV = 1 − Var(e)/Var(y).
The maximum is one because variances are nonnegative. A zero score means the centered errors vary as much as the target. Negative values occur when their variance is larger. There is no fixed lower bound, and the score should not be forced into a zero-to-one percentage scale.
Compare it with R² on the same observations. With empirical variances normalized by n, mean squared error equals Var(e) + mean(e)². Consequently R² = EV − mean(e)²/Var(y). The two metrics agree when the average error is zero, but can differ substantially otherwise.
Evaluate on data representing the intended use, preferably held out from model fitting and selection. A training-set score can exaggerate performance. For time-dependent predictions, preserve the timing of available information and use an evaluation design consistent with deployment.
When target values are constant, the denominator is zero. The raw formula gives an undefined zero-over-zero result when error variance is also zero, or negative infinity when error variance is positive. Constant but incorrect predictions also produce zero error variance; they are not perfect predictions.
Software may replace these nonfinite results for convenience. Scikit-learn's force_finite setting defaults to replacing the zero-error-variance case with one and the positive-error-variance case with zero. Record this convention, inspect constant targets, and avoid interpreting replacements as ordinary evidence of model quality.
For multiple outputs, inspect individual scores and specify whether they are averaged equally, weighted by output variance, or combined using another weighting scheme. An aggregate can conceal poor performance on one output.

Three practical examples

  • A demand-model team uses explained variance alongside mean error and RMSE to distinguish tracking of changes from calibration.
  • A sensor analyst checks whether predictions reproduce variation while inspecting any persistent offset.
  • A multioutput regression team reports per-output scores before combining results across quantities with different variability.

Think of it this way

Think of a musician following every rise and fall in a melody while singing the entire tune one note too high. The pattern matches, but the absolute level is wrong.

Worked example

Take invented observed values y = [2, 4, 6] and predictions ŷ = [3, 5, 7]. The observed mean is 4 and the target variance, using division by three, is (4 + 0 + 4)/3 = 8/3.
Every prediction error is −1, so error variance is zero. Explained variance is 1 − 0/(8/3) = 1.
However, the predictions are all one unit too high. Mean error is −1, mean absolute error is 1, and RMSE is 1. The ordinary R² score is 1 − 3/8 = 0.625.
Subtracting one from every prediction would make predictions perfect without changing explained variance. This demonstrates why the metric should be accompanied by measures that respond to systematic offsets. The example is an arithmetic illustration, not a fitted-model performance claim.

Illustrative case study

Fictional case: Birch Forecasting celebrates an explained variance score near one for its delivery-time model. Operations staff notice that every forecast is late by roughly the same amount. The analytics team adds mean error and absolute-error measures to its evaluation and investigates the offset using separate calibration data. This invented case shows that a high variability score alone can miss an operationally important mistake.

Common misconceptions and mistakes

Do not describe a score of one as necessarily perfect prediction. Constant offsets are invisible to this metric.
Do not interchange explained variance with R² without checking average error. Do not confuse it with a principal-component explained-variance ratio.
An improvement across different datasets may reflect different target variability rather than a better model. Compare like with like, and inspect constant-target handling before accepting an automatically generated score.

Business use

Explained variance can help diagnose whether a regression model tracks changes in an outcome. For decisions involving inventory, staffing, or timing, it is usually insufficient by itself because systematic errors have costs. Pair it with bias and error-magnitude measures expressed in useful units, and retain a meaningful baseline and representative evaluation set.

People also ask

Can the score be negative?

Yes, when error variance exceeds target variance.

Does adding a constant to predictions change it?

No, because it leaves error variance unchanged.

When does it equal R²?

Under the stated definitions, when the mean prediction error is zero and target variance is positive.

Check your understanding

Why is the example's score one?

Answer: All errors are equal, giving zero variance.

Why is R² lower?

Answer: It also penalizes the nonzero mean error.

What should be checked for a constant target?

Answer: The raw formula is nonfinite, so inspect the software's replacement convention.

Related terms

  • Residual variance
  • Mean Squared Error
  • Calibration
  • Explained variation
  • R²
  • mean error
  • RMSE
  • regression evaluation

Learn next

Study the decomposition of mean squared error into error variance and squared mean error. Then compare metrics on predictions with offsets, scale errors, and constant targets.

  • Mean Squared Error
  • Error variance

More in Statistics and probability

  • Expander walk sampling - Expander walk sampling is a method of generating useful samples by following a random walk on a suitably well-connected graph called an expander.
  • Expected frequencies - Expected frequencies are the counts predicted for categories or table cells by a specified probability model, often the null hypothesis in a statistical test.
  • Experimental benchmarking - Experimental benchmarking compares estimates from a nonexperimental research method with estimates from an experiment addressing a comparable causal question.
  • Explanatory model - An explanatory model represents an outcome as related to one or more other variables.
  • Exponential dispersion model - An exponential dispersion model is a family of probability distributions whose density or probability mass function separates a natural parameter from a...
  • Exponential-logarithmic distribution - The exponential-logarithmic distribution is a continuous probability distribution for positive lifetimes, formed by combining exponential failure times with...

Sources

Scikit-learn, explained_variance_score documentation: https://scikit-learn.org/stable/modules/generated/sklearn.metrics.explained_variance_score.html Scikit-learn implementation, _regression.py: https://github.com/scikit-learn/scikit-learn/blob/afe5bcd80/sklearn/metrics/_regression.py

Previous: Explainable empirical risk minimization Next: Explained variation

  • Home
  • Daily AI Updates
  • Blog
  • AIFBL Academy
  • AI Glossary
  • Products and Tools
  • Store
  • Free CFO AI Prompt Pack
  • About Shihan Sheriff
  • Privacy Policy
  • Terms of Use
  • Refund Policy
  • Cookie Policy
  • Earnings Disclaimer