R-squared › Visualizing R-squared

Michael BrenndoerferApril 4, 20253 min read
Machine Learning from ScratchAll chapters
Part 3 of 9Foundations
Chapter 24R-squared › Visualizing R-squared
Reading section 5 of 12 · Visualizing R-squared · 3 minSection 5 of 12 · 3 min

Book contents

Section 5 of 12 · 3 min read

R-squared › Visualizing R-squaredOne section · Sections in this chapter5 / 12 ↓
Reading tools Definitions & inline links

Choose your expertise level to adjust how many terms are explained. Beginners see more tooltips, experts see fewer to maintain reading flow. Hover over underlined terms for instant definitions.

Article links

Make inline references clickable

A higher R-squared means the regression line fits the data points more closely. Below is a conceptual illustration:

Plot 1: High vs. Low R-squared

  • Left: Data points closely follow the regression line (high R-squared)
  • Right: Data points are widely scattered around the line (low R-squared)
Out[2]:
Visualization
Scatter plot of 100 observations close to a fitted regression line, titled High R-squared = 0.994, with X and Y axes.
High R-squared scenario demonstrating excellent model fit. The observations closely follow the solid regression line, indicating that the model explains a large proportion of the variance in the dependent variable. The fitted value is R² = 0.994, with minimal unexplained variation.
Scatter plot of 100 observations widely dispersed around a fitted regression line, titled Low R-squared = 0.809, with X and Y axes.
Low R-squared scenario showing a weaker model fit. The observations are widely scattered around the solid regression line, indicating that the model explains a smaller proportion of the variance. The fitted value is R² = 0.809, leaving substantially more unexplained variation than in the high-fit example.