Solution (source code)

= Solution

Include an intercept $w_0$ and let $\mathbf z$ be the chosen numerical feature vector. <Logistic regression> uses
$$
\boxed{h(\mathbf z;\mathbf w)=\sigma(w_0+\mathbf w^{\mathsf T}\mathbf z),
\qquad\sigma(u)=\frac1{1+e^{-u}}.}
$$
The <logistic function> maps every real score into $(0,1)$, allowing a <Bernoulli distribution> model for the label. Equivalently, the <log odds> are linear in the features:
$$
\log\frac h{1-h}=w_0+\mathbf w^{\mathsf T}\mathbf z.
$$
This gives a smooth differentiable <probability> model with a linear decision boundary at any fixed <probability> threshold. The sigmoid output is a fitted conditional <probability>, not a categorical prediction until a threshold is chosen.