回归预测 | Matlab基于CPO-BP基于冠豪猪算法优化BP神经网络的数据多输入单输出回归预测
目录
- 回归预测 | Matlab基于CPO-BP基于冠豪猪算法优化BP神经网络的数据多输入单输出回归预测
- 效果一览
- 基本介绍
- 程序设计
- 参考资料
效果一览
基本介绍
1.CPO-BP回归基于冠豪猪优化算法[24年新算法]-BP神经网络(多输入单输出) matlab代码
2.优化参数为权值和阈值。
3.多特征输入单输出的回归预测。程序内注释详细,数据格式为exce|格式!直接替换数据就可以用。
4.程序语言为matlab,程序可出预测效果图,迭代优化图,相关分析图,运行环境matlab2018b及以上。评价指标包括:R2、RPD、 MSE、 RMSE和MAPE等等。
5.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。
程序设计
- 完整源码和数据获取方式(资源处下载):Matlab基于CPO-BP基于冠豪猪算法优化BP神经网络的数据多输入单输出回归预测。
function [Gb_Fit,Gb_Sol,Conv_curve]=CPO(Pop_size,Tmax,lb,ub,dim,fobj)%%%%-------------------Definitions--------------------------%%
%%
Conv_curve=zeros(1,Tmax);
ub=ub.*ones(1,dim);
lb=lb.*ones(1,dim);
%%-------------------Controlling parameters--------------------------%%
%%
N=Pop_size; %% Is the initial population size.
N_min=round(0.8*Pop_size); %% Is the minimum population size.
T=2; %% The number of cycles
alpha=0.2; %% The convergence rate
Tf=0.8; %% The percentage of the tradeoff between the third and fourth defense mechanisms%%---------------Initialization----------------------%%
%%
X=initialization(Pop_size,dim,ub,lb); % Initialize the positions of crested porcupines
t=0; %% Function evaluation counter
%%---------------------Evaluation-----------------------%%
for i=1:Pop_sizefitness(i)=fobj(X(i,:));
end
% Update the best-so-far solution
[Gb_Fit,index]=min(fitness);
Gb_Sol=X(index,:);
%% A new array to store the personal best position for each crested porcupine
Xp=X;%% Optimization Process of CPO
while t<=Tmax r2=rand;for i=1:Pop_sizeU1=rand(1,dim)>rand;if rand<rand %% Exploration phaseif rand<rand %% First defense mechanism%% Calculate y_ty=(X(i,:)+X(randi(Pop_size),:))/2;X(i,:)=X(i,:)+(randn).*abs(2*rand*Gb_Sol-y);else %% Second defense mechanismy=(X(i,:)+X(randi(Pop_size),:))/2;X(i,:)=(U1).*X(i,:)+(1-U1).*(y+rand*(X(randi(Pop_size),:)-X(randi(Pop_size),:)));endelseYt=2*rand*(1-t/(Tmax))^(t/(Tmax));U2=rand(1,dim)<0.5*2-1;
参考资料
[1] https://blog.csdn.net/kjm13182345320/article/details/129215161
[2] https://blog.csdn.net/kjm13182345320/article/details/128105718