Machine Learning

Coefficient of Determination (R-Squared)

The coefficient of determination, or R-squared, measures how much of the variation in an outcome a regression model explains, where 1 means a perfect fit and 0 means no better than predicting the average.

What is the coefficient of determination (R-squared)?

The coefficient of determination, written R-squared, measures how much of the variation in an outcome a regression model accounts for. It divides the sum of the model’s squared errors by the same sum for a baseline that always predicts the average, then subtracts the result from 1. A score of 1 means the predictions match every actual value. A score of 0 means no better than the average, and on new data the score can fall below 0.

For a simple linear regression with one input, R-squared equals the square of the correlation between the input and the outcome.

R-squared in practice

A third-party logistics provider predicts the labor hours each warehouse shift needs from the order lines, units, and trailer unloads on the schedule. An R-squared of 0.85 on held-out shifts tells the operations manager that the model captures most of the swing in labor demand. The rest reflects factors outside the model, such as new hires still learning the floor. What counts as a good score depends on the domain, because physical processes are easier to predict than customer behavior.

What to watch for

  • Adding inputs to a linear regression never lowers R-squared on the training data, so compare models with adjusted R-squared or on held-out data.
  • A high score does not mean the errors are small enough for the decision, so report mean absolute error alongside it.
  • R-squared says nothing about whether the relationship is causal.

← Back to AI Glossary