For a hard-margin SVM trained on linearly separable points, how do you prove that the leave-one-out error is at most , where is the number of support vectors, and what does this imply about the expected test error?
Supervised learning, Support vector machines
Level L5 Expert. Length Medium. Nature Th+Mat Both.
What's being asked
Whether you can use the optimality conditions to show that removing a non-support vector leaves the SVM unchanged, and connect leave-one-out error to test error.
Key idea
Leave-one-out (LOO) error trains times, each time leaving one point out and testing on it. If point has dual variable , the same still satisfies the KKT conditions of the problem without point , and since the problem is convex, it is still optimal. Point has margin under it, so it is classified correctly. Only leaving out a support vector can cause a LOO error.
Steps
- Recall the KKT conditions (the optimality conditions for constrained problems) for the dual solution : , , , , and complementary slackness . Here are the labels, and support vectors are the points with .
- Take a non-support vector () and remove it. Keep the same and the remaining . Stationarity still holds, because the removed term was zero. Feasibility and complementary slackness for the other points are unchanged.
- Conclude optimality. The SVM is a convex quadratic programme with linear constraints, so the KKT conditions are sufficient: is optimal for the smaller problem. is unique there, because is strictly convex.
- Test the left-out point: , so it is classified correctly. Hence every LOO error comes from a support vector, there are at most of them, and dividing by gives the bound.
- State the implication. The LOO error on points is an almost unbiased estimate of the test error of a classifier trained on points (the Luntz–Brailovsky theorem). So : few support vectors relative to mean good generalisation, whatever the dimension.
Common mistakes
- Asserting the solution is unchanged without proving it is still optimal. Use KKT sufficiency, or argue that the old solution is feasible for a problem with fewer constraints and already achieves the old optimum.
- Claiming every support vector causes an error. The bound is only an upper bound; most support vectors are usually still classified correctly when left out.
- Forgetting that if is not unique, the bound uses the support vectors of the particular solution; the tightest version counts only the essential support vectors.
How long your answer should be
Half a page of proof; about 5 minutes.
Last checked on 4 December 2026.
Read this
- Worrell, Computational Learning Theory Lecture 10: Margin Theory (Oxford): Section 2 (Leave-One-Out Analysis): Proposition 1 proves that the expected LOO error on m+1 points equals the expected test error of a classifier trained on m (Luntz-Brailovsky), and Theorem 1 gives E[err] <= E[N_SV]/(m+1).
- Stanford CS229 Lecture Notes (Ng & Ma): Free PDF. Sections 6.5-6.6 (Lagrange duality; Optimal margin classifiers: the dual form), pp. 66-73: the KKT conditions and complementary slackness (alpha_i > 0 only for points with functional margin 1) that the proof relies on.
Previous in Supervised learning: A random forest has features (a truly informative binary variable) and (a continuous pure-noise variable). Why can mean decrease in impurity (MDI) rate as important, and how does permutation importance on the out-of-bag (OOB) data fix this? What is its own weakness with correlated features?
Next in Supervised learning: For two classes, how do you derive the asymptotic error of the 3-nearest-neighbour rule as a function of the posterior , and how do you show that it is never worse than the 1-NN rule at every ? What are the errors of both rules when the local Bayes error is ?