【预测模型-ELM预测】基于原子搜索算法优化极限学习机预测matlab代码

该文提出了一种利用原子搜索算法改进极限学习机(ELM)的变压器故障诊断方法。通过优化ELM的输入层和隐含层权重及阈值,提高了模型的稳定性和预测精度。与传统ELM相比,该方法能更准确地进行故障诊断。具体步骤包括确定ELM结构、编码权重和阈值、训练和测试、种群优化等。仿真结果验证了改进方法的优越性。
摘要由CSDN通过智能技术生成

​1 简介

针对变压器故障的特征,结合变压器油中气体分析法以及三比值法.提出了基于原子搜索算法改进极限学习机的故障诊断方法.由于输入层与隐含层的权值和阈值是随机产生.传统的极限学习机可能会使隐含层节点过多,训练过程中容易产生过拟合现象.该方法运用原子搜索算法对极限学习机的输入层与隐含层的权值与阈值进行优化,从而提高模型的稳定性和预测精度.将诊断结果与传统的基于极限学习机故障诊断进行对比,结果表明,基于原子搜索算法改进极限学习机变压器故障诊断的精度更高.

基于ASO 优化 ELM 的变压器故障诊断的具体步骤为:

1)确定 ELM 的拓扑结构。即输入层神经元个数,隐含层神经元个数以及输出层神经元个数;

2)对 ELM 中输入层到隐含层的权值以及阈值进行编码,得到初始种群;

3)解码得到权值和阈值,将权值和阈值带入到ELM 的训练网络中,使用训练样本进行训练;

4)训练完成后,使用测试样本进行测试,将测试样本的期望值和预测值的误差平方和作为适应度函数;

5)对种群进行选择,交叉,变异,得到新的种群,如果满足条件,则得出了误差平方和最小的网络权值和阈值,如果不满足条件,则返回步骤 2);

6)将优化后的权值和阈值带入到训练网络中,计算隐含层输出矩阵 H, 并求解矩阵 H 的 MoorePenrose 广义逆 H+;

7)计算输出层权值β赞=H+T;

8)将测试样本带入到模型中进行预测。

2 部分代码

%--------------------------------------------------------------------------

% Atom Search Optimization.

function [X_Best,Fit_XBest,Functon_Best]=ASO(alpha,beta,Fun_Index,Atom_Num,Max_Iteration)

% Dim: Dimension of search space.

% Atom_Pop: Population (position) of atoms.

% Atom_V:  Velocity of atoms.

% Acc: Acceleration of atoms.

% M: Mass of atoms. 

% Atom_Num: Number of atom population.

% Fitness: Fitness of atoms.

% Max_Iteration: Maximum of iterations.

% X_Best: Best solution (position) found so far. 

% Fit_XBest: Best result corresponding to X_Best. 

% Functon_Best: The fitness over iterations. 

% Low: The low bound of search space.

% Up: The up bound of search space.

% alpha: Depth weight.

% beta: Multiplier weight

alpha=50;

beta=0.2;

   Iteration=1;

   [Low,Up,Dim]=Test_Functions_Range(Fun_Index); 

   % Randomly initialize positions and velocities of atoms.

     if size(Up,2)==1

         Atom_Pop=rand(Atom_Num,Dim).*(Up-Low)+Low;

         Atom_V=rand(Atom_Num,Dim).*(Up-Low)+Low;

     end

   

     if size(Up,2)>1

        for i=1:Dim

           Atom_Pop(:,i)=rand(Atom_Num,1).*(Up(i)-Low(i))+Low(i);

           Atom_V(:,i)=rand(Atom_Num,1).*(Up(i)-Low(i))+Low(i);

        end

     end

 % Compute function fitness of atoms.

     for i=1:Atom_Num

       Fitness(i)=Test_Functions(Atom_Pop(i,:),Fun_Index,Dim);

     end

       Functon_Best=zeros(Max_Iteration,1);

       [Max_Fitness,Index]=min(Fitness);

       Functon_Best(1)=Fitness(Index);

       X_Best=Atom_Pop(Index,:);

     

 % Calculate acceleration.

 Atom_Acc=Acceleration(Atom_Pop,Fitness,Iteration,Max_Iteration,Dim,Atom_Num,X_Best,alpha,beta);

 % Iteration

 for Iteration=2:Max_Iteration 

           Functon_Best(Iteration)=Functon_Best(Iteration-1);

           Atom_V=rand(Atom_Num,Dim).*Atom_V+Atom_Acc;

           Atom_Pop=Atom_Pop+Atom_V;     

    

    

         for i=1:Atom_Num

       % Relocate atom out of range.  

           TU= Atom_Pop(i,:)>Up;

           TL= Atom_Pop(i,:)<Low;

           Atom_Pop(i,:)=(Atom_Pop(i,:).*(~(TU+TL)))+((rand(1,Dim).*(Up-Low)+Low).*(TU+TL));

           %evaluate atom. 

           Fitness(i)=Test_Functions(Atom_Pop(i,:),Fun_Index,Dim);

         end

        [Max_Fitness,Index]=min(Fitness);      

     

        if Max_Fitness<Functon_Best(Iteration)

             Functon_Best(Iteration)=Max_Fitness;

             X_Best=Atom_Pop(Index,:);

          else

            r=fix(rand*Atom_Num)+1;

             Atom_Pop(r,:)=X_Best;

        end

     

      % Calculate acceleration.

       Atom_Acc=Acceleration(Atom_Pop,Fitness,Iteration,Max_Iteration,Dim,Atom_Num,X_Best,alpha,beta);

 end

Fit_XBest=Functon_Best(Iteration); 

 

3 仿真结果

4 参考文献

[1]郑嘉利, & 王哲. (2019). 一种基于蝗虫算法和极限学习机的RFID室内定位方法.  CN109598320A.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Matlab科研辅导帮

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值