Sum of Squared Errors (SSE) › Mathematical Foundation

Michael BrenndoerferApril 22, 20252 min read
Machine Learning from ScratchAll chapters
Part 3 of 9Foundations
Chapter 23Sum of Squared Errors (SSE) › Mathematical Foundation
Reading section 3 of 10 · Mathematical Foundation · 2 minSection 3 of 10 · 2 min

Book contents

Section 3 of 10 · 2 min read

Sum of Squared Errors (SSE) › Mathematical FoundationOne section · Sections in this chapter3 / 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

The SSE Formula

The Sum of Squared Errors is defined as:

SSE=∑i=1n(yi−y^i)2SSE = \sum_{i=1}^n (y_i - \hat{y}_i)^2

Where:

  • yiy_i: The actual (observed) value for the ii-th observation
  • y^i\hat{y}_i: The predicted value for the ii-th observation from our model
  • nn: The total number of observations
  • The summation runs over all nn data points

Key Components

Residuals: The difference (yi−y^i)(y_i - \hat{y}_i) is called a residual - it represents how far off our prediction is from the actual value. A residual can be positive (prediction too low) or negative (prediction too high).

Squaring: We square each residual to:

  • Eliminate the sign (make all differences positive)
  • Penalize larger errors more heavily (squared errors grow quadratically)
  • Ensure the metric is always non-negative

Summation: Adding up all squared residuals gives us the total error across all observations.

Alternative Notations

SSE is also known by several other names in different contexts, which can sometimes lead to confusion when reading different textbooks or research papers. While the underlying calculation remains the same, the terminology may shift depending on the field or the author's preference. Here are some of the most common alternative names for SSE:

  • Sum of Squared Residuals (SSR): Emphasizes that we're measuring residuals
  • Residual Sum of Squares (RSS): Another common notation
  • Error Sum of Squares: Focuses on the error component

All refer to the same mathematical concept: ∑i=1n(yi−y^i)2\sum_{i=1}^n (y_i - \hat{y}_i)^2