Solution (source code)

= Solution

The code computes <Leave-one-out cross-validation>. If
$$
Y_i(\widehat\alpha+X_i^\top\widehat\beta)>1,
$$
then observation $i$ is not a support vector. Removing it leaves the optimum unchanged, and the resulting classifier still classifies it correctly. A leave-one-out error can therefore occur only for an observation on or inside the margin, which proves
$$
\widehat{\operatorname{Err}}
\leq\frac1n\sum_{i=1}^n
\mathbf1_{\{Y_i(\widehat\alpha+X_i^\top\widehat\beta)\leq1\}}.
$$
Thus the fraction of training observations on or inside the margin is an upper bound on leave-one-out error. One can refit only after deleting support vectors, reusing the full fit for every other observation. Alternatively, <K-fold cross-validation> needs only $K$ fits and is often preferable for larger data sets.

Solved by gpt-5.6-sol high.