回归预测 | Matlab实现WOA-CNN-SVM鲸鱼算法优化卷积神经网络-支持向量机的多输入单输出回归预测
目录
效果一览
基本介绍
1.WOA-CNN-SVM鲸鱼算法优化卷积神经网络-支持向量机的多变量回归预测 可直接运行Matlab;
2.评价指标包括: R2、MAE、RMSE和MAPE等,代码质量极高,方便学习和替换数据。要求2021版本及以上。
3.鲸鱼算法WOA优化的参数为:CNN的批处理大小、学习率、正则化系数,能够避免人工选取参数的盲目性,有效提高其预测精度。
4.main.m为主程序,其他为函数文件,无需运行,data为数据,多输入单输出,数据回归预测,输入7个特征,输出1个变量,直接替换Excel数据即可用!注释清晰,适合新手小白~
程序设计
- 完整程序和数据获取方式:私信博主回复Matlab实现WOA-CNN-SVM鲸鱼算法优化卷积神经网络-支持向量机的多输入单输出回归预测;
matlab
% The Whale Optimization Algorithm
function [Best_Cost,Best_pos,curve]=WOA(pop,Max_iter,lb,ub,dim,fobj)
% initialize position vector and score for the leader
Best_pos=zeros(1,dim);
Best_Cost=inf; %change this to -inf for maximization problems
%Initialize the positions of search agents
Positions=initialization(pop,dim,ub,lb);
curve=zeros(1,Max_iter);
t=0;% Loop counter
% Main loop
while t<Max_iter
for i=1:size(Positions,1)
% Return back the search agents that go beyond the boundaries of the search space
Flag4ub=Positions(i,:)>ub;
Flag4lb=Positions(i,:)<lb;
Positions(i,:)=(Positions(i,:).*(~(Flag4ub+Flag4lb)))+ub.*Flag4ub+lb.*Flag4lb;
% Calculate objective function for each search agent
fitness=fobj(Positions(i,:));
% Update the leader
if fitness<Best_Cost % Change this to > for maximization problem
Best_Cost=fitness; % Update alpha
Best_pos=Positions(i,:);
end
end
参考资料
[1] https://blog.csdn.net/kjm13182345320/article/details/129036772?spm=1001.2014.3001.5502
[2] https://blog.csdn.net/kjm13182345320/article/details/128690229