Solution (source code)

= Solution

First recode the labels as $y_i=2Y_i-1\in\{-1,1\}$; with labels $0$ and $1$, the displayed constraints for class zero can never hold. Add an unpenalized intercept $b$ so that the separating hyperplane need not pass through the origin, and solve
$$
\min_{b,\beta}\frac12\|\beta\|_2^2
\quad\text{subject to}\quad
y_i(b+X_i^T\beta)\geq1.
$$
Centering and scaling predictor columns is also advisable because the Euclidean penalty depends on their units.