Every classifier, once it's trained, is secretly drawing something you can picture: an invisible line (or, in more than two dimensions, a curved or flat surface) cutting through feature space. Everything on one side of that line gets one label; everything on the other side gets the other. That line is the decision boundary, and it is often the single clearest way to see what a trained classifier actually learned — far clearer than squinting at a list of numbers.
With two features, the boundary of a linear classifier is a single straight line splitting the
plane in two. It is exactly the set of points where the model is perfectly undecided, scoring
On one side
This isn't a separate idea bolted onto
The two weights and the bias are the boundary. Adjust them and watch the dividing line
swing and shift, the shaded half-planes following along. The arrow is the weight vector
Try dragging
Add a third feature and the dividing line grows into a flat plane slicing space
into two half-spaces — points on one side get one label, points on the other get the other. Here are
two classes of points and the plane
Suppose a trained 2-feature linear classifier has weights
That's a line of slope 2 crossing the
So the origin's side of the line is the class-0 region, and the opposite side is class 1. Now
classify a brand-new point,
No probabilities, no sigmoid needed at prediction time — once you have the boundary, classifying a
new point is just "which side of the line is it on?" Compare two more new points:
Logistic regression is happy with any line that has the training points sorted correctly
on either side — even one that grazes right past a few points with barely any room to spare. That
can be a problem: a boundary squeezed tight against the data is more likely to misclassify a new
point that lands just slightly differently than the training examples did. Some classifiers, like
A linear boundary is a straight line (a flat hyperplane in higher dimensions) — simple, fast, and often enough. But imagine a dataset shaped like a target: class A packed in a small disc near the origin, and class B scattered in a ring all the way around it. No straight line, however you tilt or shift it, can ever put every class-A point on one side and every class-B point on the other — the inner disc is surrounded on all sides by the ring.
When classes interlock like this, you reach for curved boundaries: add polynomial features (so a
straight boundary in the new, richer feature space becomes a curve back in the original one), or
let a
Two traps that catch people reading a decision boundary:
Because it works. Plotting two features on a chart, colouring each training point by its true class, and drawing the model's boundary through them like a coastline separating two coloured "countries" is one of the most common — and most useful — diagrams in all of machine learning teaching. It turns an abstract list of weights into something you can look at and immediately judge: does this shape make sense for this data?
That same picture also explains a famously strange phenomenon called an adversarial example: an image an AI classifies as, say, a "panda" can sometimes be nudged by a tiny, human-imperceptible change so it crosses to the wrong side of the model's boundary and gets classified as something absurd, like a "gibbon" — with the model suddenly very confident about it. Knowing that a boundary is just a surface in feature space, and that some points sit dangerously close to it, makes that trick far less mysterious.