回归预测 | MATLAB实现WOA-ELM鲸鱼算法优化极限学习机多输入单输出回归预测
目录
- 回归预测 | MATLAB实现WOA-ELM鲸鱼算法优化极限学习机多输入单输出回归预测
- 效果一览
- 基本介绍
- 程序设计
- 参考资料
效果一览
基本介绍
Matlab实现WOA-ELM鲸鱼算法优化极限学习机多输入回归预测(完整源码和数据)
1.Matlab实现WOA-ELM鲸鱼算法优化极限学习机多输入单输出回归预测(完整源码和数据)
2.输入多个特征,输出单个变量,多输入单输出回归预测;
3.多指标评价,评价指标包括:R2、MAE、MSE、RMSE等,代码质量极高;
4.鲸鱼算法优化参数为:优化参数为权值和阈值;
5.excel数据,方便替换,运行环境2018及以上。
程序设计
- 完整程序和数据下载方式1(资源处直接下载):MATLAB实现WOA-ELM鲸鱼算法优化极限学习机多输入单输出回归预测
- 完整程序和数据下载方式2(订阅《ELM极限学习机》专栏,同时可阅读《ELM极限学习机》专栏收录的所有内容,数据订阅后私信我获取):MATLAB实现WOA-ELM鲸鱼算法优化极限学习机多输入单输出回归预测
- 完整程序和数据下载方式3(订阅《智能学习》专栏,同时获取《智能学习》专栏收录程序3份,数据订阅后私信我获取):MATLAB实现WOA-ELM鲸鱼算法优化极限学习机多输入单输出回归预测
%% 计算初始适应度值
fitness = zeros(1, pop);
for i = 1 : pop
fitness(i) = fobj(pop_new(i, :));
end
%% 得到全局最优适应度值
[fitness, index]= sort(fitness);
GBestF = fitness(1);
%% 得到全局最优种群
for i = 1 : pop
pop_new(i, :) = pop_lsat(index(i), :);
end
GBestX = pop_new(1, :);
X_new = pop_new;
%% 优化算法
for i = 1: Max_iter
BestF = fitness(1);
R2 = rand(1);
for j = 1 : PDNumber
if(R2 < ST)
X_new(j, :) = pop_new(j, :) .* exp(-j / (rand(1) * Max_iter));
else
X_new(j, :) = pop_new(j, :) + randn() * ones(1, dim);
end
end
for j = PDNumber + 1 : pop
if(j > (pop - PDNumber) / 2 + PDNumber)
X_new(j, :) = randn() .* exp((pop_new(end, :) - pop_new(j, :)) / j^2);
else
A = ones(1, dim);
for a = 1 : dim
if(rand() > 0.5)
A(a) = -1;
end
end
AA = A' / (A * A');
X_new(j, :) = pop_new(1, :) + abs(pop_new(j, :) - pop_new(1, :)) .* AA';
end
end
Temp = randperm(pop);
SDchooseIndex = Temp(1 : SDNumber);
for j = 1 : SDNumber
if(fitness(SDchooseIndex(j)) > BestF)
X_new(SDchooseIndex(j), :) = pop_new(1, :) + randn() .* abs(pop_new(SDchooseIndex(j), :) - pop_new(1, :));
elseif(fitness(SDchooseIndex(j)) == BestF)
K = 2 * rand() -1;
X_new(SDchooseIndex(j), :) = pop_new(SDchooseIndex(j), :) + K .* (abs(pop_new(SDchooseIndex(j), :) - ...
pop_new(end, :)) ./ (fitness(SDchooseIndex(j)) - fitness(end) + 10^-8));
end
end
%% 边界控制
for j = 1 : pop
for a = 1 : dim
if(X_new(j, a) > ub(a))
X_new(j, a) = ub(a);
end
if(X_new(j, a) < lb(a))
X_new(j, a) = lb(a);
end
end
end
%% 获取适应度值
for j = 1 : pop
fitness_new(j) = fobj(X_new(j, :));
end
%% 获取最优种群
for j = 1 : pop
if(fitness_new(j) < GBestF)
GBestF = fitness_new(j);
GBestX = X_new(j, :);
end
end
%% 更新种群和适应度值
pop_new = X_new;
fitness = fitness_new;
%% 更新种群
[fitness, index] = sort(fitness);
for j = 1 : pop
pop_new(j, :) = pop_new(index(j), :);
end
%% 得到优化曲线
curve(i) = GBestF;
avcurve(i) = sum(curve) / length(curve);
end
%% 得到最优值
Best_pos = GBestX;
Best_score = curve(end);
参考资料
[1] https://blog.csdn.net/kjm13182345320/article/details/129215161
[2] https://blog.csdn.net/kjm13182345320/article/details/128105718