The logistic function is $g(x) = \frac{1}{1+e^{-x}}$, and it's derivative is $g'(x) = (1-g(x))g(x)$.
Now if the argument of my logistic function is say $x+2x^2+ab$, with $a,b$ being constants, and I derive with respect to x: $(\frac{1}{1+e^{-x+2x^2+ab}})'$, is the derivative still $(1-g(x))g(x)$?
$\endgroup$ 12 Answers
$\begingroup$Suppose $g(x) = (1+\exp(-h(x))^{-1}$
then \begin{align}g'(x)&=-(1+\exp(-h(x))^{-2}\exp(-h(x))(-h'(x))\\ &=g(h(x))\frac{\exp(-h(x))}{1+\exp(-h(x))}h'(x)\\ &=g(h(x))\frac{1+\exp(-h(x))-1}{1+\exp(-h(x))}h'(x) \\ &=g(h(x))(1-g(h(x)))h'(x)\end{align}
In this case $h(x)=x+2x^2+ab$, then $h'(x)=4x+1$.
$\endgroup$ $\begingroup$No. You need to remember to use the chain rule here. If $g'(x) = (1-g(x))g(x)$, then $$\frac{\mathrm{d}}{\mathrm{d}x} g(f(x)) = g'(f(x))\cdot f'(x) = (1-g(f(x)))\cdot g(f(x))\cdot f'(x)$$ In this case, $f(x) = 2x^2-x+ab$, so $f'(x) = 4x-1$. Therefore, $$\frac{\mathrm{d}}{\mathrm{d}x}\left[\frac{1}{1+e^{2x^2-x+ab}}\right] = \left(1-\frac{1}{1+e^{2x^2-x+ab}}\right)\frac{4x-1}{1+e^{2x^2-x+ab}}$$
$\endgroup$ 2