Logistic regression

Problem

The loss function for a single example label pair in logistic regression can be written as \begin{align} \mathcal{L}(\theta) = y\log \sigma(\theta^Tx) + (1 - y) \log (1-\sigma(\theta^Tx)) \end{align} where and and is the sigmoid function.

Show that the gradient with respect to the parameters is given by \begin{align} \nabla_\theta \mathcal{L}(\theta) = (y - \sigma(x)) x. \end{align}

Solution

show