激活函数

函数图像

  • 红色:ReLU

  • 蓝色:Tanh

  • 绿色:Sigmoid

  • 紫色:Linear

ReLU(Rectified Linear Unit)

此激活函数广泛应用于各种深度学习网络中。

f(x)={xx>00x0\displaystyle{f(x) = \begin{cases} x & x > 0 \\ 0 & x \leqslant 0 \end{cases}}

f(x)={1x>00x0\displaystyle{f'(x) = \begin{cases} 1 & x > 0 \\ 0 & x \leqslant 0 \end{cases}}

S形函数(Sigmoid)

此激活函数早期广泛应用于神经网络中,但是由于梯度饱和问题,超过三层时误差就无法传到最初的层了,因此在深度学习中效果不如ReLU。

f(x)=11+ex\displaystyle{f(x) = \frac{1}{1+e^{-x}}}

f(x)=f(x)(1f(x))\displaystyle{f'(x) = f(x)(1-f(x))}

双曲正切函数(Hyperbolic tangent)

双曲正切函数简称Tanh函数,类似于Sigmoid函数,不过函数值范围是-1~1。

f(x)=exexex+ex\displaystyle{f(x) = \frac{e^x - e^{-x}}{e^x + e^{-x}}}

f(x)=1f2(x)\displaystyle{f'(x) = 1-f^2(x)}

线性(Linear)

线性相当于没有激活函数,每层之间直接进行矩阵乘法,无法学习非线性数据。

f(x)=x\displaystyle{f(x)=x}

f(x)=1\displaystyle{f'(x)=1}

Last updated

Was this helpful?