Solution (source code)

= Solution

For $X_i^*=(1,X_i^T)^T$ and $\gamma=(\gamma_0,\beta^T)^T$, a linear <support vector machine> predicts
$$
\widehat C_\gamma(x)=\operatorname{sign}(\gamma_0+x^T\beta).
$$
One penalized formulation minimizes empirical <hinge loss> plus a squared <Euclidean norm> penalty:
$$
\widehat\gamma\in\underset{\gamma\in\mathbb R^{p+1}}{\operatorname{argmin}}
\left\{
\sum_{i=1}^n\max(0,1-Y_iX_i^{*T}\gamma)
+\lambda\|\gamma\|_2^2
\right\},
\qquad \lambda>0.
$$
Conventions often leave the intercept unpenalized, replacing $\|\gamma\|_2^2$ by $\|\beta\|_2^2$; this does not change the role of the two terms.