Cost function

$$J(\theta) = \frac{1}{2m} \sum^m_{i=1} (H_\theta(X^{(i)}) - y^{(i)})^2$$

$$Cost(h_\theta(X), y) = \begin{cases} -log(h_\theta(X)),&\text{if }y=1 \\
-log(1-h_\theta(X)),&\text{if }y=0 \end{cases} $$

P.S. Katex tips: in Hugo’s math mode, to get line separator for multi-line equations, use ‘\’ $\times 6$ instead of ‘\\‘. And if a function faild, add ‘\’ as escape char for random ‘_’s might help (annoying…I know…)