Solved – Derivation of the Hessian of average empirical loss for Logistic Regression

hessianlogisticregression

The original derivation

  • How does the y term vanish/get cancelled ?

Shouldn't it be this instead, h here is the Sigmoid function.

The proposed equation

Best Answer

The expression is correct but only for logistic regression where the outcome is $+1$ or $-1$ [i.e. $y(i) = 1$ or $-1$].

If $y(i) = 1$ or $-1$, $y(i)^2$ is always one.

You can expand and simplify the $h(\theta)$ expressions to show: \begin{align}H(\theta)[-y(i)x(i)]{1-H(\theta)[-y(i)x(i)]} &= \frac1{1+\exp[-y(i)x(i)]} \cdot \frac1{1+\exp[y(i)x(i)]} \\&= \frac1{1+\exp[-x(i)]} \cdot \frac1{1+\exp[x(i)]} \end{align}

if $y(i)$ is $1$ or $-1$.

$$\frac1{1+\exp[x(i)]} \cdot \frac1{1+\exp[x(i)]}$$ is equal to the last the h(theta) expressions in the original photo, and given that $y(i)^2$ is always one, this proves your second expression is equal to the first in the special case when $y(i)$ is $1$ or $-1$.

Hope this helps.