1 简介
ELM是一个单隐层神经网络,具有良好的泛化和快速学习能力,该算法只需用户调整隐含层节点个数,但该参数的选择直接影响了ELM的性能.文章提出一种新的优化方案,该方案使用GSA优化输入特征子集和隐含层节点数以提高ELM的性能,实验结果表明:该方法在识别电能质量扰动方面更快,更准确.基于GSA的ELM电能质量扰动分类系统首先通过GSA检测最佳特征子集,接着使用GSA估计最佳隐含层节点数,以达到自动优化ELM分类器的准确性。图1为基于GSA的ELM优化分类框架。
2 部分代码
% GSA code
[Fbest,Lbest,BestChart,MeanChart]=GSA(F_index,N,max_it,ElitistCheck,min_flag,Rpower,k,I,E1,Pos,Siv,n)
%V: Velocity.
%a: Acceleration.
%M: Mass. Ma=Mp=Mi=M;
%dim: Dimension of the test function.
%N: Number of agents.
%X: Position of agents. dim-by-N matrix.
%R: Distance between agents in search space.
%[low-up]: Allowable range for search space.
%Rnorm: Norm in eq.8.
%Rpower: Power of R in eq.7.
Rnorm=2;
%get allowable range and dimension of the test function.
[low,up,dim]=test_functions_range(F_index);
%random initialization for agents.
X=initialization(dim,N,up,low);
%create the best so far chart and average fitnesses chart.
BestChart=[];MeanChart=[];
V=zeros(N,dim);
for iteration=1:max_it
% iteration
%Checking allowable range.
X=space_bound(X,up,low);
%Evaluation of agents.
fitness=evaluateF(X,F_index);
if min_flag==1
[best best_X]=min(fitness); %minimization.
else
[best best_X]=max(fitness); %maximization.
end
if iteration==1
Fbest=best;Lbest=X(best_X,:);
end
if min_flag==1
if best<Fbest %minimization.
Fbest=best;Lbest=X(best_X,:);
end
else
if best>Fbest %maximization
Fbest=best;Lbest=X(best_X,:);
end
end
BestChart=[BestChart Fbest];
MeanChart=[MeanChart mean(fitness)];
%Calculation of M. eq.14-20
[M]=massCalculation(fitness,min_flag);
%Calculation of new fitness function using BBO
Nfit=newFitness(M,I,E1,k,Siv,Pos,n);
%Calculation of Gravitational constant. eq.13.
G=Gconstant(iteration,max_it);
%Calculation of accelaration in gravitational field. eq.7-10,21.
a=Gfield(M,X,G,Rnorm,Rpower,ElitistCheck,iteration,max_it);
%Increase in search space from local to global range using BBO
Gss=gSearchspace(a,I,E1,k,n);
%Agent movement. eq.11-12
[X,V]=move(X,a,V);
end %iteration
3 仿真结果
4 参考文献
[1]李斌, 韩晓红. 基于GSA的ELM电能质量扰动识别方法研究[J]. 中国高新技术企业, 2015(29):3.
博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。
部分理论引用网络文献,若有侵权联系博主删除。