Linear Classifiers › The Geometry: Decision Boundaries

Michael BrenndoerferApril 28, 20255 min read
Language AI HandbookAll chapters
Part 10 of 67Neural Network Foundations
Chapter 61Linear Classifiers › The Geometry: Decision Boundaries
Reading section 3 of 16 · The Geometry: Decision Boundaries · 5 minSection 3 of 16 · 5 min

Book contents

Section 3 of 16 · 5 min read

Linear Classifiers › The Geometry: Decision BoundariesOne section · Sections in this chapter3 / 16 ↓
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

Understanding linear classifiers geometrically reveals both their power and their limitations. In two dimensions, the decision boundary is a line. In three dimensions, it is a plane. In dd dimensions, it is a (d−1)(d-1)-dimensional hyperplane. The critical insight is that this boundary is always flat.

The decision boundary is defined by the equation:

w⋅x+b=0\mathbf{w} \cdot \mathbf{x} + b = 0

where:

  • w\mathbf{w}: the weight vector (the normal to the hyperplane)
  • x\mathbf{x}: a point on the boundary
  • bb: the bias, which shifts the boundary parallel to itself (without bb, the boundary must pass through the origin)

On one side of this hyperplane, w⋅x+b>0\mathbf{w} \cdot \mathbf{x} + b > 0 and the classifier predicts the positive class. On the other side, w⋅x+b<0\mathbf{w} \cdot \mathbf{x} + b < 0 and it predicts the negative class.

The weight vector w\mathbf{w} is always perpendicular to the decision boundary and points toward the positive region. To see why: for any two points x1\mathbf{x}_1 and x2\mathbf{x}_2 that both lie on the decision boundary (so both satisfy w⋅x+b=0\mathbf{w} \cdot \mathbf{x} + b = 0), their difference satisfies:

w⋅(x1−x2)=(w⋅x1+b)−(w⋅x2+b)=0−0=0\mathbf{w} \cdot (\mathbf{x}_1 - \mathbf{x}_2) = (\mathbf{w} \cdot \mathbf{x}_1 + b) - (\mathbf{w} \cdot \mathbf{x}_2 + b) = 0 - 0 = 0

where:

  • x1−x2\mathbf{x}_1 - \mathbf{x}_2: any vector lying in the decision boundary hyperplane
  • The equation shows this vector is orthogonal to w\mathbf{w}, confirming w\mathbf{w} is the normal direction
Out[5]:
Visualization
2D scatter plot showing linear decision boundary, weight vector, positive and negative class clusters.
A linear classifier in 2D feature space. The decision boundary (solid neutral line) separates positive examples (blue circles) from negative examples (red crosses). The weight vector w (green arrow) is perpendicular to the boundary and points toward the positive region. The color gradient shows the raw classifier score, ranging from high positive values (blue) to high negative values (red), illustrating that score magnitude encodes distance from the boundary.

The score w⋅x+b\mathbf{w} \cdot \mathbf{x} + b gives more than just a class label: it also provides a measure of confidence. Points far from the boundary have large absolute scores, indicating the classifier is confident. Points close to the boundary have scores near zero, indicating uncertainty. This magnitude becomes important when we convert scores to probabilities.

The distance from a point x\mathbf{x} to the decision boundary has a precise geometric meaning. It equals ∣w⋅x+b∣∥w∥\frac{|\mathbf{w} \cdot \mathbf{x} + b|}{\|\mathbf{w}\|}, the absolute score divided by the norm of the weight vector. A point with a high absolute score is geometrically far from the boundary, explaining why large scores correspond to high confidence. This distance interpretation connects linear classifiers to support vector machines (SVMs), which find the linear boundary that maximizes the minimum distance to any training point. SVMs are essentially linear classifiers with a specific training objective (maximum margin) rather than cross-entropy loss.

Changing the Boundary Through Weight Changes

Training a linear classifier means finding the weight vector w\mathbf{w} and bias bb that place the decision boundary in a good location, separating the training classes as cleanly as possible. As w\mathbf{w} changes direction, the hyperplane rotates. As bb changes, the hyperplane translates parallel to itself. Together, these d+1d + 1 degrees of freedom (one per feature plus the bias) determine the full family of linear boundaries.

An important observation is that scaling w\mathbf{w} and bb by the same constant does not change the decision boundary at all. Multiplying w\mathbf{w} and bb by 2 produces the same hyperplane, but the raw scores are twice as large, and the sigmoid transformation of those scores produces more extreme probability estimates. This means the norm ∥w∥\|\mathbf{w}\| controls model confidence while the direction w/∥w∥\mathbf{w}/\|\mathbf{w}\| controls the boundary location. Regularization, which we discuss later, constrains ∥w∥\|\mathbf{w}\| to prevent the model from becoming overconfident.