Equation for likelihood in logistic regression
By the definition of the logistic regression model $\mathrm P(y = 1 | x,w) = \sigma\left(\left&lt;w, x\right&gt;\right)$ thus $\mathrm P(y = 0 | x,w) = 1- \sigma\left(\left&lt;w, x\right&gt;\right)$

You should be able to verify (by setting y=0/y=1) that this is equivalent to

$\mathrm P(y | x,w) = \sigma\left(\left&lt;w, x\right&gt;\right)^y \left[ 1- \sigma \left( \left&lt;w, x \right&gt; \right) \right]^{1-y}$

I think you understand the rest?