skip to content

Maximum-Margin Classifier

The widest street between two classes is pinned by a handful of support vectors, and moving any other training point changes nothing. Interviewers ask what a support vector actually is.

on this pageshow

questions

4

Why is a hard-margin SVM unchanged when you delete a training point that is not a support vector?

level: juniorimportance: must knowfreq 70%

answer

  1. only the closest points touch the boundary
  2. the kerbs rest on a few rows
  3. constraints that bind versus constraints with slack
  4. twelve rows out of five thousand
  5. removing slack constraints changes no optimum

basics

~20 s

Only the training points lying exactly on the margin boundary - the support vectors - hold the hyperplane in place. Every other point sits strictly further away, so removing it leaves the same widest street and the same fitted boundary.

solid answer

~50 s

In a hard-margin support vector machine the fitted hyperplane is the centre of the widest empty street between the classes, and the kerbs of that street rest on a handful of training points: the **support vectors**, the points at the minimum distance from the boundary. Every other point sits strictly further away, satisfying its constraint with room to spare, so it is not touching anything. Delete it and the widest street is still the same street: same boundary, same margin, byte-identical model. A concrete case: fit on 5,000 rows and find that 12 of them are support vectors - you could throw away the other 4,988 rows, refit, and recover exactly the same classifier. That is why the model is so compact at prediction time. The flip side is that moving or deleting a support vector generally does change the solution, since you have removed one of the constraints that was actually binding.

go deeper

for a junior

Be ready to name the support vectors as the training points sitting exactly on the margin boundary, and to say that everything further in has slack and so cannot affect the fit.

for a middle

Explain it as constraint activity: each row is an inequality constraint, the binding ones are the support vectors, and dropping an inactive constraint provably leaves the optimum where it is.

for a senior

Point out the asymmetry and its operating consequence - the boundary can rest on a dozen rows, so refits on slightly different data can move it, and the support-vector fraction is worth monitoring as a complexity and data-quality signal.

for a principal

Frame the tradeoff you are buying: a model defined by a handful of frontier rows is compact and auditable but concentrates risk in the least representative part of the data. Decide when that concentration is acceptable versus when a smoother, all-points-vote estimator is safer.

## What a support vector is A hard-margin support vector machine looks for the hyperplane that maximises the distance to the nearest training point of either class. Writing the surface as `w.x + b = 0` and labels as +1 / -1, the fitted solution satisfies `y_i * (w.x_i + b) >= 1` for every training point, under the usual convention that the closest points are pinned at exactly 1. The points that attain that equality - the ones sitting exactly on the margin boundary, on the kerb of the street - are the **support vectors**. Everything else has `y_i * (w.x_i + b) > 1` strictly: it is inside its own territory with slack to spare. ## Binding and non-binding constraints The geometric statement has an optimisation statement behind it. Each training point contributes one inequality constraint. A constraint that holds with equality at the optimum is *active*, or binding: it is pressing on the solution, and relaxing or removing it would let the objective improve. A constraint that holds strictly is *inactive*: the optimum is nowhere near it, so deleting it changes nothing about where the optimum sits. Support vectors are exactly the active constraints. All other rows are inactive. Removing an inactive constraint from an optimisation problem leaves the optimum untouched - not approximately, exactly. This is why the fitted model is unchanged. ## The 5,000-row picture Suppose you fit on 5,000 labelled rows and discover that 12 of them are support vectors. Then: - Deleting any single one of the other 4,988 rows and refitting gives the identical hyperplane, to the last bit. - Deleting all 4,988 at once and refitting on just those 12 rows still gives the identical hyperplane, because those 12 constraints alone define the same widest street. - Prediction time only ever needs the fitted `w` and `b`, and in the dual view only those 12 rows carry nonzero weight - hence the model's famous compactness. ## The other direction Symmetry does not hold. Delete or move a support vector and you have removed a binding constraint, so the street can usually widen or tilt: the boundary moves. That is the real substance of the sensitivity, and it is why one should not be complacent about a model whose entire boundary rests on twelve rows. Conversely, moving a non-support vector *within its own side* changes nothing at all - until it moves close enough to become the new closest point, at which point it becomes a support vector itself and starts constraining the solution. ## Why the count is informative The number of support vectors is a rough complexity signal. A classic result bounds the leave-one-out error rate of a hard-margin machine by the number of support vectors divided by the number of training points: intuitively, leaving out a non-support vector cannot change the model, so it cannot be misclassified by the refit unless it already was. Twelve support vectors out of 5,000 therefore corresponds to a very small leave-one-out bound - the data is separated by an unusually clean, wide gap. A model where most rows are support vectors is the opposite signal: the classes crowd the frontier, and the boundary is held in place by nearly everything. ## What candidates get wrong The most common error is saying support vectors are the points *closest to the other class's centre*, or the points that were misclassified. In the hard-margin setting nothing is misclassified; support vectors are simply the points at the minimum distance from the surface. Another error is assuming that because most rows are ignorable, you may safely subsample the training data up front - you cannot, because you do not know which rows are support vectors until you have fitted on all of them, and subsampling can discard exactly the points that define the boundary.

  • What happens if you delete or move a support vector instead?
    The boundary generally moves. A support vector is a binding constraint, so removing it lets the street widen or tilt, and moving it drags the kerb it sits on. This asymmetry is the practical caution: the whole boundary can rest on a very small number of rows near the frontier.
  • What does it mean if almost every training row turns out to be a support vector?
    It means the classes crowd the boundary, with little clean space between them. The leave-one-out bound tied to the support-vector fraction becomes uninformative, the model is no longer compact, and it is a signal that a linear separation in these features is a poor fit for the data.
  • Can you subsample the training data first, since most rows do not matter?
    No, because you cannot tell which rows are support vectors until you have fitted on the full data. Random subsampling can drop exactly the frontier points that define the boundary, producing a wider, wrong-looking margin. The redundancy is only visible after the fact.

A tent's shape is set by the few poles touching the fabric. You can walk anyone standing in the middle of the field away and the tent stands exactly as it was; pull out a pole and it changes shape.

saying these in an interview costs you the question

  • Says support vectors are the misclassified training points
  • Defines them as the points nearest the other class's centroid
  • Claims removing any single point leaves the model unchanged
  • Thinks you can safely subsample rows before fitting
  • Confuses the number of support vectors with the number of features

context

open as a page

Why does a support vector machine pick the widest-margin separating hyperplane over any other?

level: middleimportance: must knowfreq 75%

basics

~20 s

When two classes are linearly separable, infinitely many hyperplanes separate them and all score zero training errors. The maximum-margin one sits as far as possible from the nearest point of each class, leaving a buffer that unseen points are less likely to cross.

open as a page

What is the difference between the functional margin and the geometric margin of a separating hyperplane?

level: middleimportance: should knowfreq 45%

basics

~20 s

The functional margin of a point is the signed score y times (w.x + b); the geometric margin divides that by the length of w, giving an actual perpendicular distance. Rescaling w and b inflates the functional margin but leaves the geometric one unchanged.

open as a page

A hard-margin SVM separates 200 rows of 5,000-feature data perfectly. Why is that unsurprising?

level: seniorimportance: nice to knowfreq 28%

basics

~20 s

With far more features than rows, points in general position can be separated by a hyperplane for essentially any labelling, including random ones. Perfect separation therefore carries almost no information; the width of the margin relative to the data's spread is the quantity worth reading.

open as a page