赞
踩
Sigmoid 函数的公式如下:
σ ( x ) = 1 1 + e − x \sigma(x) = \frac{1}{1 + e^{-x}} σ(x)=1+e−x1
求导之前,先看一下 x x x 是如何一步一步变化到 σ ( x ) \sigma(x) σ(x)的:
σ : x → − x → e − x → 1 + e − x → ( 1 + e − x ) − 1 \sigma : x\rightarrow-x \rightarrow e^{-x} \rightarrow 1 + e^{-x} \rightarrow (1+e^{-x})^{-1} σ:x→−x→e−x→1+e−x→(1+e−x)−1
假设有如下四个函数:
f
:
x
→
−
x
f : x\rightarrow -x
f:x→−x
g
:
f
→
e
f
g : f\rightarrow e^{f}
g:f→ef
h
:
g
→
1
+
g
h : g\rightarrow 1 + g
h:g→1+g
σ
:
h
→
h
−
1
\sigma: h\rightarrow h^{-1}
σ:h→h−1
那么有:
σ
(
x
)
=
h
∘
g
∘
f
(
x
)
\sigma(x) = h \circ g \circ f(x)
σ(x)=h∘g∘f(x)
根据链式求导法则:
∂
σ
∂
x
=
∂
σ
∂
h
∂
h
∂
g
∂
g
∂
f
∂
f
∂
x
\frac{\partial{\sigma}}{\partial{x}} = \frac{\partial{\sigma}}{\partial{h}}\frac{\partial{h}}{\partial{g}}\frac{\partial{g}}{\partial{f}}\frac{\partial{f}}{\partial{x}}
∂x∂σ=∂h∂σ∂g∂h∂f∂g∂x∂f
其中
∂
σ
∂
h
=
−
h
−
2
\frac{\partial{\sigma}}{\partial{h}} = -h^{-2}
∂h∂σ=−h−2
∂
h
∂
g
=
1
\frac{\partial{h}}{\partial{g}} = 1
∂g∂h=1
∂
g
∂
f
=
e
f
\frac{\partial{g}}{\partial{f}} = e^{f}
∂f∂g=ef
∂
f
∂
x
=
−
1
\frac{\partial{f}}{\partial{x}} = -1
∂x∂f=−1
所以:
∂
σ
∂
x
=
−
h
−
2
⋅
1
⋅
e
f
⋅
(
−
1
)
\frac{\partial{\sigma}}{\partial{x}} =-h^{-2}\cdot1\cdot e^{f}\cdot(-1)
∂x∂σ=−h−2⋅1⋅ef⋅(−1)
其中:
h
=
1
+
e
−
x
h = 1+e^{-x}
h=1+e−x
f
=
−
x
f=-x
f=−x
所以:
即:
∂
σ
∂
x
=
σ
(
x
)
⋅
(
1
−
σ
(
x
)
)
\frac{\partial{\sigma}}{\partial{x}}=\sigma{(x)}\cdot(1-\sigma{(x)})
∂x∂σ=σ(x)⋅(1−σ(x))
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。