商丘做网站用什么程序比较好,商城开源免费商用,淘宝关键词搜索量查询工具,网站主机安全时序预测 | Matlab实现PSO-Elman粒子群优化递归神经网络时间序列预测 目录 时序预测 | Matlab实现PSO-Elman粒子群优化递归神经网络时间序列预测效果一览基本介绍程序设计参考资料 效果一览 基本介绍
Matlab实现PSO-Elman粒子群优化递归神经网络时间序列预测#xff08;完整源…时序预测 | Matlab实现PSO-Elman粒子群优化递归神经网络时间序列预测 目录 时序预测 | Matlab实现PSO-Elman粒子群优化递归神经网络时间序列预测效果一览基本介绍程序设计参考资料 效果一览 基本介绍
Matlab实现PSO-Elman粒子群优化递归神经网络时间序列预测完整源码和数据
1.输入输出单个变量
2.一维时间序列预测
3.多指标评价代码质量极高excel数据方便替换运行环境2018及以上
4.评价指标MAE、MSE、RMSE、MAPE、R2代码质量极高方便学习和替换数据
5.要求2018版本及以上优化神经网络单元数。
程序设计
%% 粒子群算法
function [Best_pos,Best_score,curve]PSO(pop,Max_iter,lb,ub,dim,fobj,Vmax,Vmin)
%% 参数设置
w 0.9; % 惯性因子
c1 2; % 加速常数
c2 2; % 加速常数Dim dim; % 维数
sizepop pop; % 粒子群规模
maxiter Max_iter; % 最大迭代次数
if(max(size(ub)) 1)ub ub.*ones(1,dim);lb lb.*ones(1,dim);
end
fun fobj; %适应度函数%% 粒子群初始化
Range ones(sizepop,1)*(ub-lb);
pop rand(sizepop,Dim).*Range ones(sizepop,1)*lb; % 初始化粒子群
V rand(sizepop,Dim)*(Vmax-Vmin) Vmin; % 初始化速度
fitness zeros(sizepop,1);
for i1:sizepopfitness(i,:) fun(pop(i,:)); % 粒子群的适应值
end%% 个体极值和群体极值
[bestf, bestindex]min(fitness);
zbestpop(bestindex,:); % 全局最佳
gbestpop; % 个体最佳
fitnessgbestfitness; % 个体最佳适应值
fitnesszbestbestf; % 全局最佳适应值%% 迭代寻优
iter 0;
while( (iter maxiter ))for j1:sizepop% 速度更新V(j,:) w*V(j,:) c1*rand*(gbest(j,:) - pop(j,:)) c2*rand*(zbest - pop(j,:));if V(j,:)VmaxV(j,:)Vmax;endif V(j,:)VminV(j,:)Vmin;end% 位置更新pop(j,:)pop(j,:)V(j,:);for k1:Dimif pop(j,k)ub(k)pop(j,k)ub(k);endif pop(j,k)lb(k)pop(j,k)lb(k);endend% 适应值fitness(j,:) fun(pop(j,:));% 个体最优更新if fitness(j) fitnessgbest(j)gbest(j,:) pop(j,:);fitnessgbest(j) fitness(j);end% 群体最优更新if fitness(j) fitnesszbestzbest pop(j,:);fitnesszbest fitness(j);endenditer iter1; % 迭代次数更新curve(iter) fitnesszbest;
end
%% 绘图
Best_pos zbest;
Best_score fitnesszbest;
end
参考资料 [1] https://blog.csdn.net/kjm13182345320/article/details/129215161 [2] https://blog.csdn.net/kjm13182345320/article/details/128105718