MATLAB常见的学习率下降策略
凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/
1. 几种常见的学习率下降策略(learning rate decay strategy)
t:自变量,迭代次数,λ(t):因变量,学习率,T:常量,最大迭代次数,其他参数均为常量,可自行设定。可以设定初始学习率λ(0):
1) exp
2) inv
3) plot
4) sigmoid
5) cosine_decay
6) Gaussian
2. MATLAB程序
function learning_rate_decay(choose) % Author: kailugaji 凯鲁嘎吉 - 博客园 http://www.cnblogs.com/kailugaji/ max_iter=1000; y=zeros(1, max_iter); t=1:max_iter; if choose==1 % cosine decay y(t)=0.5*(1+cos(pi*t/max_iter)); elseif choose==2 % plot p>1:凹曲线, 0<p<1:凸曲线 p=0.25; y(t)=(1-(t/max_iter)).^p; elseif choose==3 % inv gamma=0.99; p=0.25; y(t)=(1+gamma*t).^(-p); elseif choose==4 % exp gamma=0.99; y(t)=gamma.^t; elseif choose==5 % sigmoid gamma=-0.01; stepsize=max_iter/2; y(t)=1./(1+exp(-gamma*(t-stepsize))); elseif choose==6 % Gaussian sigma=300; y(t)=exp(-(t.^2)/(2*(sigma^2))); else disp('input error!'); end %% plot(t, y); axis([1, max_iter, 0, 1]); xlabel('iter'); ylabel('learning rate');
3. 学习率衰减
4. 参考文献
Tensorflow中learning rate decay的奇技淫巧
TensorFlow学习--学习率衰减/learning rate decay
邱锡鹏, 神经网络与深度学习[M]. 2019.