1 简介
人工神经网络的最大缺点是训练时间太长从而限制其实时应用范围,近年来,极限学习机(Extreme Learning Machine, ELM)的提出使得前馈神经网络的训练时间大大缩短,然而当原始数据混杂入大量噪声变量时,或者当输入数据维度非常高时,极限学习机算法的综合性能会受到很大的影响.深度学习算法的核心是特征映射,它能够摒除原始数据中的噪声,并且当向低维度空间进行映射时,能够很好的起到对数据降维的作用,因此我们思考利用深度学习的优势特性来弥补极限学习机的弱势特性从而改善极限学习机的性能.为了进一步提升DELM预测精度,本文采用灰狼搜索算法进一步优化DELM超参数,仿真结果表明,改进算法的预测精度更高。
编辑
编辑
编辑
编辑
编辑
2 部分代码
% Grey Wold Optimizer (GWO) source codes version 1.1 %% %% Developed in MATLAB R2011b(7.13) %% %% Author and programmer: Seyedali Mirjalili %% %% e-Mail: ali.mirjalili@gmail.com %% seyedali.mirjalili@griffithuni.edu.au %% %% Homepage: http://www.alimirjalili.com/GWO.html %% %% Main paper: S. Mirjalili, S. M. Mirjalili, A. Lewis %% Grey Wolf Optimizer, Advances in Engineering %% Software, Volume 69, March 2014, Pages 46-61, %% http://dx.doi.org/10.1016/j.advengsoft.2013.12.007 %% %% Grey Wolf Optimizerfunction [Alpha_score,Alpha_pos,Convergence_curve]=GWO(SearchAgents_no,Max_iter,lb,ub,dim,fobj,handles,Value)% initialize alpha, beta, and delta_posAlpha_pos=zeros(1,dim);Alpha_score=inf; %change this to -inf for maximization problemsBeta_pos=zeros(1,dim);Beta_score=inf; %change this to -inf for maximization problemsDelta_pos=zeros(1,dim);Delta_score=inf; %change this to -inf for maximization problems%Initialize the positions of search agentsPositions=initialization(SearchAgents_no,dim,ub,lb);%Convergence_curve=zeros(1,Max_iter);l=0;% Loop counter% Main loopwhile l<Max_iter for i=1:size(Positions,1) % Calculate objective function for each search agent fitness=fobj(Positions(i,:)); All_fitness(1,i)=fitness; % Update Alpha, Beta, and Delta if fitness<Alpha_score Alpha_score=fitness; % Update alpha Alpha_pos=Positions(i,:); end if fitness>Alpha_score && fitness<Beta_score Beta_score=fitness; % Update beta Beta_pos=Positions(i,:); end if fitness>Alpha_score && fitness>Beta_score && fitness<Delta_score Delta_score=fitness; % Update delta Delta_pos=Positions(i,:); end end a=2-l*((2)/Max_iter); % a decreases linearly fron 2 to 0 % Update the Position of search agents including omegas for i=1:size(Positions,1) for j=1:size(Positions,2) r1=rand(); % r1 is a random number in [0,1] r2=rand(); % r2 is a random number in [0,1] A1=2*a*r1-a; % Equation (3.3) C1=2*r2; % Equation (3.4) D_alpha=abs(C1*Alpha_pos(j)-Positions(i,j)); % Equation (3.5)-part 1 X1=Alpha_pos(j)-A1*D_alpha; % Equation (3.6)-part 1 r1=rand(); r2=rand(); A2=2*a*r1-a; % Equation (3.3) C2=2*r2; % Equation (3.4) D_beta=abs(C2*Beta_pos(j)-Positions(i,j)); % Equation (3.5)-part 2 X2=Beta_pos(j)-A2*D_beta; % Equation (3.6)-part 2 r1=rand(); r2=rand(); A3=2*a*r1-a; % Equation (3.3) C3=2*r2; % Equation (3.4) D_delta=abs(C3*Delta_pos(j)-Positions(i,j)); % Equation (3.5)-part 3 X3=Delta_pos(j)-A3*D_delta; % Equation (3.5)-part 3 Positions(i,j)=(X1+X2+X3)/3;% Equation (3.7) end % Return back the search agents that go beyond the boundaries of the search space Flag4ub=Positions(i,:)>ub; Flag4lb=Positions(i,:)<lb; Positions(i,:)=(Positions(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb; end l=l+1; Convergence_curve(l)=Alpha_score; if l>1 line([l-1 l], [Convergence_curve(l-1) Convergence_curve(l)],'Color','b') xlabel('Iteration'); ylabel('Best score obtained so far'); drawnow end set(handles.itertext,'String', ['The current iteration is ', num2str(l)]) set(handles.optimumtext,'String', ['The current optimal value is ', num2str(Alpha_score)]) if Value==1 hold on scatter(l*ones(1,SearchAgents_no),All_fitness,'.','k') endend
3 仿真结果
编辑
4 参考文献
[1]张志宏, 刘传领. 基于灰狼算法优化深度学习网络的网络流量预测[J]. 吉林大学学报:理学版, 2021.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。
编辑