回归预测 | MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出

回归预测 | MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出

目录

    • 回归预测 | MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出
      • 预测效果
      • 基本介绍
      • 程序设计
      • 学习总结
      • 往期精彩
      • 参考资料

预测效果

回归预测 | MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出_第1张图片
回归预测 | MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出_第2张图片
回归预测 | MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出_第3张图片
回归预测 | MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出_第4张图片

基本介绍

MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出

程序设计

  • 完整程序和数据下载:MATLAB实现PSO-BiLSTM(粒子群优化双向长短期记忆神经网络)多输入单输出
% 1. 寻找最佳参数
NN=5;                   %初始化群体个数
D=2;                    %初始化群体维数,
T=10;                   %初始化群体最迭代次数
c1=2;                   %学习因子1
c2=2;                   %学习因子2
%用线性递减因子粒子群算法
Wmax=1.2; %惯性权重最大值
Wmin=0.8; %惯性权重最小值
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%每个变量的取值范围
ParticleScope(1,:)=[10 200];  % 中间层神经元个数
ParticleScope(2,:)=[0.01 0.15]; % 学习率
ParticleScope=ParticleScope';
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
xv=rand(NN,2*D); %首先,初始化种群个体速度和位置
for d=1:D
    xv(:,d)=xv(:,d)*(ParticleScope(2,d)-ParticleScope(1,d))+ParticleScope(1,d);  
    xv(:,D+d)=(2*xv(:,D+d)-1 )*(ParticleScope(2,d)-ParticleScope(1,d))*0.2;
end
x1=xv(:,1:D);%位置
v1=xv(:,D+1:2*D);%速度
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%------初始化个体位置和适应度值-----------------
p1=x1;
pbest1=ones(NN,1);
for i=1:NN
    pbest1(i)=fitness(x1(i,:));
end
%------初始时全局最优位置和最优值---------------
gbest1=min(pbest1);
lab=find(min(pbest1)==pbest1);
g1=x1(lab,:);
gb1=ones(1,T);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

学习总结

PSO模拟鸟群的捕食行为。一群鸟在随机搜索食物,在这个区域里只有一块食物。所有的鸟都不知道食物在那里。但是他们知道当前的位置离食物还有多远。那么找到食物的最优策略是什么呢。最简单有效的就是搜寻离食物最近的鸟的周围区域。双向循环神经网络(BRNN)的基本思想是提出每一个训练序列向前和向后分别是两个循环神经网络(RNN),而且这两个都连接着一个输出层。

往期精彩

[1] MATLAB实现PSO-GRU(粒子群优化门控循环单元)多输入单输出
[2] MATLAB实现PSO-LSTM(粒子群优化长短期记忆神经网络)多输入单输出

参考资料

[1] https://blog.csdn.net/kjm13182345320/article/details/127855723?spm=1001.2014.3001.5501
[2] https://blog.csdn.net/kjm13182345320/article/details/127857829?spm=1001.2014.3001.5501

你可能感兴趣的:(回归预测,PSO-BiLSTM,粒子群优化,双向长短期记忆神经网络,多输入单输出)