ELU激活函数以及python画图

Elu激活函数论文:https://arxiv.org/pdf/1511.07289v5.pdf
论文理解:https://blog.csdn.net/mao_xiao_feng/article/details/53242235?locationNum=9&fps=1
https://blog.csdn.net/m0_37561765/article/details/78398098
https://blog.csdn.net/u012524708/article/details/79579313
ELU激活函数以及python画图_第1张图片
Elu函数融合了sigmoid和ReLU,左侧具有软饱和性,右侧无饱和性。右侧线性部分使得ELU能够缓解梯度消失,而左侧软饱能够让ELU对输入变化或噪声更鲁棒。ELU的输出均值接近于零,所以收敛速度更快。在 ImageNet上,不加 Batch Normalization 30 层以上的 ReLU 网络会无法收敛,PReLU网络在MSRA的Fan-in (caffe )初始化下会发散,而 ELU 网络在Fan-in/Fan-out下都能收敛。

python画激活函数
参考:https://blog.csdn.net/Xin_101/article/details/93738819
(threshold、sigmoid、Relu、PRelu、tanh)
Elu函数

import matplotlib.pyplot as plt
import mpl_toolkits.axisartist as axisartist
import numpy as np
import math
fig = plt.figure(figsize=(6, 6))
ax = axisartist.Subplot(fig, 111)
fig.add_axes(ax)
# 隐藏坐标轴
ax.axis[:].set_visible(False)
# 添加坐标轴
ax.axis['x'] = ax.new_floating_axis(0, 0)
ax.axis['y'] = ax.new_floating_axis(1, 0)
# x轴添加箭头
ax.axis['x'].set_axisline_style('-|>', size=1.0)
ax.axis['y'].set_axisline_style('-|>', size=1.0)
# 设置坐标轴刻度显示方向
ax.axis['x'].set_axis_direction('top')
ax.axis['y'].set_axis_direction('right')
plt.xlim(-10, 10)
plt.ylim(-2.5, 10)
x_1 = np.arange(0, 10, 0.1)
y_1 = x_1
x_axis = np.arange(-10, 10, 0.2)
y_axis = np.arange(-0, 1, 0.2)
plt.plot(x_1, y_1, 'r-', label=r'Elu=$\{\stackrel{x,x>0}{\alpha(exp(x)-1), x<=0}$')
x_2 = np.arange(-10, 0, 0.1)
y_2 = 1*(np.exp(x_2)-1)
plt.plot(x_2, y_2, 'r-')
plt.legend()
#plt.savefig('lu.jpg')
plt.show()

你可能感兴趣的:(python,深度学习,elu,激活函数,python,画图)