【预测模型】基于Logistic混沌映射改进麻雀算法改进BP神经网络实现数据预测matlab源码
2021/9/25 12:40:53
本文主要是介绍【预测模型】基于Logistic混沌映射改进麻雀算法改进BP神经网络实现数据预测matlab源码,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
1 模型
简介见这里。
2 部分代码
function [FoodFitness,FoodPosition,Convergence_curve]=SSA(N,Max_iter,lb,ub,dim,fobj) if size(ub,1)==1 ub=ones(dim,1)*ub; lb=ones(dim,1)*lb; end Convergence_curve = zeros(1,Max_iter); %Initialize the positions of salps SalpPositions=initialization(N,dim,ub,lb); FoodPosition=zeros(1,dim); FoodFitness=inf; %calculate the fitness of initial salps for i=1:size(SalpPositions,1) SalpFitness(1,i)=fobj(SalpPositions(i,:)); end [sorted_salps_fitness,sorted_indexes]=sort(SalpFitness); for newindex=1:N Sorted_salps(newindex,:)=SalpPositions(sorted_indexes(newindex),:); end FoodPosition=Sorted_salps(1,:); FoodFitness=sorted_salps_fitness(1); %Main loop l=2; % start from the second iteration since the first iteration was dedicated to calculating the fitness of salps while l<Max_iter+1 c1 = 2*exp(-(4*l/Max_iter)^2); % Eq. (3.2) in the paper for i=1:size(SalpPositions,1) SalpPositions= SalpPositions'; if i<=N/2 for j=1:1:dim c2=rand(); c3=rand(); %%%%%%%%%%%%% % Eq. (3.1) in the paper %%%%%%%%%%%%%% if c3<0.5 SalpPositions(j,i)=FoodPosition(j)+c1*((ub(j)-lb(j))*c2+lb(j)); else SalpPositions(j,i)=FoodPosition(j)-c1*((ub(j)-lb(j))*c2+lb(j)); end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end elseif i>N/2 && i<N+1 point1=SalpPositions(:,i-1); point2=SalpPositions(:,i); SalpPositions(:,i)=(point2+point1)/2; % % Eq. (3.4) in the paper end SalpPositions= SalpPositions'; end for i=1:size(SalpPositions,1) Tp=SalpPositions(i,:)>ub';Tm=SalpPositions(i,:)<lb';SalpPositions(i,:)=(SalpPositions(i,:).*(~(Tp+Tm)))+ub'.*Tp+lb'.*Tm; SalpFitness(1,i)=fobj(SalpPositions(i,:)); if SalpFitness(1,i)<FoodFitness FoodPosition=SalpPositions(i,:); FoodFitness=SalpFitness(1,i); end end Convergence_curve(l)=FoodFitness; l = l + 1; end
3 仿真结果
4 参考文献
《基于BP神经网络的宁夏水资源需求量预测》
这篇关于【预测模型】基于Logistic混沌映射改进麻雀算法改进BP神经网络实现数据预测matlab源码的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2025-01-12深入理解 ECMAScript 2024 新特性:Map.groupBy() 分组操作
- 2025-01-11国产医疗级心电ECG采集处理模块
- 2025-01-10Rakuten 乐天积分系统从 Cassandra 到 TiDB 的选型与实战
- 2025-01-09CMS内容管理系统是什么?如何选择适合你的平台?
- 2025-01-08CCPM如何缩短项目周期并降低风险?
- 2025-01-08Omnivore 替代品 Readeck 安装与使用教程
- 2025-01-07Cursor 收费太贵?3分钟教你接入超低价 DeepSeek-V3,代码质量逼近 Claude 3.5
- 2025-01-06PingCAP 连续两年入选 Gartner 云数据库管理系统魔力象限“荣誉提及”
- 2025-01-05Easysearch 可搜索快照功能,看这篇就够了
- 2025-01-04BOT+EPC模式在基础设施项目中的应用与优势