A standard sigmoid function used in machine learning is the logistic function

$σ(x) =11 +e−x$

Part of the reason for its use is the simplicity of its first derivative:

$σ′ =e−x (1+e−x )2 =1 +e−x -1 (1+e−x )2 =σ-σ2 =σ (1-σ)$

To evaluate higher-order derivatives, assume an expression of the form

$σ(n) =∑k=1 n+1 cn,k σk$

with ${c}_{0,1}\equiv 1$ to return the function itself when no derivative is taken. Since the expression always contains a linear term, the next derivative is

$σ(n+1) =σ′∑ k=1 n+1 kcn,k σk-1 σ (n+1) =∑k=1 n+1 kcn,k [σk -σk+1 ] σ (n+1) =∑k=1 n+1 kcn,k σk -∑k=2 n+2 (k-1) cn,k-1 σk σ(n+1) =cn,1σ -(n+1) cn,n+1 σn+2 +∑k=2 n+1 [kcn,k -(k-1) cn,k-1 ]σk ≡∑k=1 n+2 cn+1,k σk$

where terms in each sum with indices not included in the other sum have been separated. Comparing these separated terms with the first and last terms on the right-hand side gives

$cn+1,1 =cn,1 cn+1, n+2 =−(n+1) cn,n+1$

The left-hand expression here indicates that all coefficients for $k=1$ are equal. With the initial value already assumed for consistency with not taking a derivative, this means ${c}_{n,1}=1$ .

The remaining right-hand expression indicates that there is a change in sign and an additional numerical factor every time either n or k increases. Inspecting the pair of terms in brackets in the last line of the derivative evaluation, the index that changes is not n but k. Assuming the latter is responsible for the behavior of the right-hand expression, one can take

$cn,k =(−1 )k+1 (k-1)! S(n+1,k)$

where the remaining functional behavior will be determined by comparing the remaining terms of the derivative evaluation. Canceling common factors, this gives

$S(n+2,k) =kS(n+1 ,k) +S(n+1, k-1)$

This is the recursion relation for Stirling numbers of the second kind, quantities well known in combinatorics and number theory. Explicit values are available online as OEIS A008277. The offset in the first index is necessary due to how Stirling numbers are defined.

The final expression for the arbitrary multiple derivative of the sigmoid function is thus

$σ(n) =∑k=1 n+1 (−1 )k+1 (k-1)! S(n+1,k) σk$

This result is consistent with the evaluation by Minai and Williams. Explicit values of the coefficients can also be found online as OEIS A163626.

These derivatives find application in using neural networks to solve differential equations.

The results of this presentation are unchanged if the function is taken with a either a positive or negative sign in the denominator,

$σ(x) =11 ±e−x$

because the first derivative remains the same:

$σ′ =±e−x (1±e−x )2 =1 ±e−x -1 (1±e−x )2 =σ-σ2 =σ (1-σ)$

One can in fact use any positive or negative amount as a multiplicative factor in the denominator, since it arises as a constant of integration in solving the differential equation:

$σ′ σ(1-σ) =σ′σ +σ′ 1-σ =1 lnσ -ln(1-σ) =x-lnc σ1-σ =exc → σ=11 +ce−x$

Curiouser and curiouser...

Uploaded 2020.02.22 — Updated 2020.06.13 analyticphysics.com