Sum of Squared Errors (SSE) › Visualizing SSE

Michael BrenndoerferApril 22, 20254 min read
Machine Learning from ScratchAll chapters
Part 3 of 9Foundations
Chapter 23Sum of Squared Errors (SSE) › Visualizing SSE
Reading section 5 of 10 · Visualizing SSE · 4 minSection 5 of 10 · 4 min

Book contents

Section 5 of 10 · 4 min read

Sum of Squared Errors (SSE) › Visualizing SSEOne section · Sections in this chapter5 / 10 ↓
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

Visualizing the Sum of Squared Errors (SSE) can provide valuable intuition about how well a model fits the data and how different types of errors contribute to the overall error. By examining graphical representations of residuals and their squared values, you can better understand the relationship between model predictions, observed values, and the total SSE.

This example demonstrates how SSE changes with different model fits and shows the geometric interpretation of squared residuals:

Out[2]:
Visualization
Good linear fit with data points, regression line, short residual stems, squared-residual squares, and SSE of 10.92.
Good model fit with low SSE. The regression line closely follows the data points, resulting in short residual stems. The squares represent squared residuals, with their areas proportional to squared-error magnitude. This visualization shows how a well-fitting model minimizes the total squared distance between predictions and actual values.
Poor linear fit with data points, regression line, long residual stems, large squared-residual squares, and SSE of 152.67.
Poor model fit with high SSE. The regression line poorly captures the underlying relationship, resulting in long residual stems and correspondingly large squared-residual squares. Their substantial areas demonstrate why this model has a much higher SSE, indicating poor predictive performance.

Understanding the Visualization

The gray vertical lines show the residuals (differences between actual and predicted values), while the green squares represent the squared residuals. The area of each square is proportional to the squared error for that point. This geometric interpretation helps understand why SSE is such an effective measure of model fit - it visually represents the total "error area" that the model is trying to minimize.