1、 sigmoid 函数
y = 1 1 + e − x y = \frac{1}{1 + e^{-x}} y=1+e−x1
导函数:
d y d x = − ( 1 + e − x ) − 2 ⋅ ( 1 + e − x ) ′ = − ( 1 + e − x ) − 2 ⋅ 1 ⋅ ( e − x ) ′ = − ( 1 + e − x ) − 2 ⋅ 1 ⋅ ( e − x ) ⋅ ( − x ) ′ = − ( 1 + e − x ) − 2 ⋅ 1 ⋅ ( e − x ) ⋅ ( − 1 ) = ( 1 + e − x ) − 2 ⋅ ( e − x ) = e − x ( 1 + e − x ) 2 \begin{aligned} \cfrac{{\rm d}y}{{\rm d}x} &= -(1 + e^{-x})^{-2} \cdot (1 + e^{-x})^\prime \\ &= -(1 + e^{-x})^{-2} \cdot 1 \cdot (e^{-x})^\prime \\ &= -(1 + e^{-x})^{-2} \cdot 1 \cdot (e^{-x}) \cdot (-x) ^\prime \\ &= -(1 + e^{-x})^{-2} \cdot 1 \cdot (e^{-x}) \cdot (-1) \\ &= (1 + e^{-x})^{-2} \cdot (e^{-x}) \\ &= \cfrac{e^{-x}}{(1 + e^{-x})^{2}} \end{aligned} dxdy=−(1+e−x)−2⋅(1+e−x)′=−(1+e−x)−2⋅1⋅(e−x)′=−(1+e−x)−2⋅1⋅(e−x)⋅(−x)′=−(1+e−x)−2⋅1⋅(e−x)⋅(−1)=(1+e−x)−2⋅(e−x)=(1+e−x)2e−x
又因为 1 − y = 1 − 1 1 + e − x = 1 + e − x − 1 1 + e − x = e − x 1 + e − x 1 - y = 1 - \cfrac{1}{1 + e^{-x}} = \cfrac{1 + e^{-x} -1}{1 + e^{-x}} = \cfrac{e^{-x}}{1 + e^{-x}} 1−y=1−1+e−x1=1+e−x1+e−x−1=1+e−xe−x
所以 d y d x = y [ 1 − y ] \cfrac{{\rm d}y}{{\rm d}x} = y[1 - y] dxdy=y[1−y]
2、Tanh 函数
y
=
t
a
n
h
(
x
)
=
e
x
−
e
−
x
e
x
+
e
−
x
=
2
s
i
g
m
o
i
d
(
2
x
)
−
1
y = {\rm tanh}(x)=\frac{e^x-e^{-x}}{e^x+e^{-x}} = 2{\rm sigmoid}(2x)-1
y=tanh(x)=ex+e−xex−e−x=2sigmoid(2x)−1
导函数:
d y d x = ( e x − e − x e x + e − x ) ′ = ( e x − e − x ) ′ ( e x + e − x ) − ( e x − e − x ) ( e x + e − x ) ′ ( e x + e − x ) 2 = ( e x + e − x ) ( e x + e − x ) − ( e x − e − x ) ( e x − e − x ) ( e x + e − x ) 2 = e 2 x + e − 2 x + 2 − ( e 2 x + e − 2 x − 2 ) ( e x + e − x ) 2 = 4 ( e x + e − x ) 2 \begin{aligned} \cfrac{{\rm d}y}{{\rm d}x} &= \left(\cfrac{e^x-e^{-x}}{e^x+e^{-x}}\right)^\prime \\ &= \cfrac{(e^x-e^{-x})^\prime(e^x+e^{-x})-(e^x-e^{-x})(e^x+e^{-x})^\prime}{(e^x+e^{-x})^2} \\ &= \cfrac{(e^x+e^{-x})(e^x+e^{-x})-(e^x-e^{-x})(e^x-e^{-x})}{(e^x+e^{-x})^2} \\ &= \cfrac{e^{2x}+e^{-2x}+2-(e^{2x}+e^{-2x}-2)}{(e^x+e^{-x})^2} \\ &= \cfrac{4}{(e^x+e^{-x})^2} \end{aligned} dxdy=(ex+e−xex−e−x)′=(ex+e−x)2(ex−e−x)′(ex+e−x)−(ex−e−x)(ex+e−x)′=(ex+e−x)2(ex+e−x)(ex+e−x)−(ex−e−x)(ex−e−x)=(ex+e−x)2e2x+e−2x+2−(e2x+e−2x−2)=(ex+e−x)24
又因为
1
−
y
=
1
−
e
x
−
e
−
x
e
x
+
e
−
x
=
e
x
+
e
−
x
−
(
e
x
−
e
−
x
)
e
x
+
e
−
x
=
2
e
−
x
e
x
+
e
−
x
1 - y = 1 - \cfrac{e^x-e^{-x}}{e^x+e^{-x}} = \cfrac{e^x+e^{-x}-(e^x-e^{-x})}{e^x+e^{-x}} = \cfrac{2e^{-x}}{e^x+e^{-x}}
1−y=1−ex+e−xex−e−x=ex+e−xex+e−x−(ex−e−x)=ex+e−x2e−x
1 + y = 1 + e x − e − x e x + e − x = e x + e − x + ( e x − e − x ) e x + e − x = 2 e x e x + e − x 1 + y = 1 + \cfrac{e^x-e^{-x}}{e^x+e^{-x}} = \cfrac{e^x+e^{-x}+(e^x-e^{-x})}{e^x+e^{-x}} = \cfrac{2e^{x}}{e^x+e^{-x}} 1+y=1+ex+e−xex−e−x=ex+e−xex+e−x+(ex−e−x)=ex+e−x2ex
所以
( 1 − y ) ( 1 + y ) = 1 − y 2 = 4 ( e x + e − x ) 2 = d y d x (1 - y)(1+y) = 1 - y^2 = \cfrac{4}{(e^x+e^{-x})^2} = \cfrac{{\rm d}y}{{\rm d}x} (1−y)(1+y)=1−y2=(ex+e−x)24=dxdy
即:
y
=
t
a
n
h
′
(
x
)
=
1
−
t
a
n
h
2
(
x
)
y = {\rm tanh}^\prime(x)=1-{\rm tanh}^2(x)
y=tanh′(x)=1−tanh2(x)
3、ReLu 函数
y
=
f
(
x
)
=
max
(
0
,
x
)
y = f(x) = \max(0,x)
y=f(x)=max(0,x)
导函数
y
′
=
f
′
(
x
)
=
{
1
,
x
>
0
0
,
x
≤
0
y^\prime = f^\prime(x) = \begin{cases} 1,& x > 0\\ 0,& x \le 0 \end{cases}
y′=f′(x)={1,0,x>0x≤0
4、Leaky ReLu 函数
y
=
f
(
x
)
=
{
x
,
x
>
0
α
⋅
x
,
x
≤
0
y = f(x) = \begin{cases} x,& x > 0\\ \alpha \cdot x,& x \le 0 \end{cases}
y=f(x)={x,α⋅x,x>0x≤0
导函数
y
′
=
f
′
(
x
)
=
{
1
,
x
>
0
α
,
x
≤
0
y^\prime = f^\prime(x) = \begin{cases} 1,& x > 0\\ \alpha,& x \le 0 \end{cases}
y′=f′(x)={1,α,x>0x≤0
5、Softplus 函数
y = f ( x ) = log ( 1 + e x ) y = f(x) = \log(1+e^x) y=f(x)=log(1+ex)
导函数
y
′
=
f
′
(
x
)
=
(
1
+
e
x
)
′
1
+
e
x
=
e
x
1
+
e
x
=
1
1
+
e
−
x
=
s
i
g
m
o
i
d
(
x
)
y^\prime = f^\prime(x) = \cfrac{(1+e^x)^\prime}{1+e^x} = \cfrac{e^x}{1+e^x} = \cfrac{1}{1+e^{-x}} = {\rm sigmoid}(x)
y′=f′(x)=1+ex(1+ex)′=1+exex=1+e−x1=sigmoid(x)
(本节完)