(15 pts) In this problem, we will find $\nabla l(\theta)$, where $l(\theta)$ is the cross-entropy loss:
$l(\theta) = -\frac{1}{n} \sum_{i=1}^{n} (y^{(i)} \log(h_{\theta}(x^{(i)})) + (1 - y^{(i)}) \log(1 - h_{\theta}(x^{(i)})))
$
a) (5 pts) Recall that $h_{\theta}(x) = g(\theta^T x)$, where $g(z) = \frac{1}{1 + e^{-z}}$. So we want
to find the derivative of $g(z)$. Show that $g'(z) = g(z)(1 - g(z))$.
b) (6 pts) Then, for $h_{\theta}(x^{(i)}) = g(z)$, where $z = \theta^T x^{(i)}$, show the following:
$\frac{\partial h_{\theta}(x^{(i)})}{\partial \theta_j} = g(z)(1 - g(z))x_j^{(i)}$
$\frac{\partial \log(h_{\theta}(x^{(i)})}{\partial \theta_j} = (1 - g(z))x_j^{(i)}$, $\frac{\partial \log(1 - h_{\theta}(x^{(i)})}{\partial \theta_j} = -g(z)x_j^{(i)}$
c) (4 pts) Finally show that:
$\frac{\partial l(\theta)}{\partial \theta_j} = \frac{1}{n} \sum_{i=1}^{n} (h_{\theta}(x^{(i)}) - y^{(i)})x_j^{(i)}$