分类预测 | Matlab实现SSA-ELM麻雀优化算法优化极限学习机分类预测
目录
- 分类预测 | Matlab实现SSA-ELM麻雀优化算法优化极限学习机分类预测
- 分类效果
- 基本描述
- 程序设计
- 参考资料
分类效果
基本描述
1.MATLAB实现SSA-ELM麻雀优化算法优化极限学习机分类预测(Matlab完整源码和数据)
2.优化参数为权值和阈值;
3.直接替换数据即可使用,保证程序可正常运行。
4.程序语言为matlab,程序可出分类效果图,迭代优化图,混淆矩阵图。
运行环境matlab2018b及以上。
5.代码特点:参数化编程、参数可方便更改、代码编程思路清晰、注释明细。
程序设计
- 完整程序和数据获取方式(资源出直接下载)Matlab实现SSA-ELM麻雀优化算法优化极限学习机分类预测。
%% 优化算法
for i = 1: Max_iterBestF = fitness(1);R2 = rand(1);for j = 1 : PDNumberif(R2 < ST)X_new(j, :) = pop_new(j, :) .* exp(-j / (rand(1) * Max_iter));elseX_new(j, :) = pop_new(j, :) + randn() * ones(1, dim);end endfor j = PDNumber + 1 : popif(j > (pop - PDNumber) / 2 + PDNumber)X_new(j, :) = randn() .* exp((pop_new(end, :) - pop_new(j, :)) / j^2);elseA = ones(1, dim);for a = 1 : dimif(rand() > 0.5)A(a) = -1;endendAA = A' / (A * A'); X_new(j, :) = pop_new(1, :) + abs(pop_new(j, :) - pop_new(1, :)) .* AA';endendTemp = randperm(pop);SDchooseIndex = Temp(1 : SDNumber); for j = 1 : SDNumberif(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));endend%% 边界控制for j = 1 : popfor a = 1 : dimif(X_new(j, a) > ub(a))X_new(j, a) = ub(a);endif(X_new(j, a) < lb(a))X_new(j, a) = lb(a);endendend %% 获取适应度值for j = 1 : popfitness_new(j) = fobj(X_new(j, :));end%% 获取最优种群for j = 1 : popif(fitness_new(j) < GBestF)GBestF = fitness_new(j);GBestX = X_new(j, :);endend%% 更新种群和适应度值pop_new = X_new;fitness = fitness_new;%% 更新种群 [fitness, index] = sort(fitness);for j = 1 : poppop_new(j, :) = pop_new(index(j), :);end%% 得到优化曲线curve(i) = GBestF;avcurve(i) = sum(curve) / length(curve);
end
参考资料
[1] https://blog.csdn.net/kjm13182345320/article/details/129036772?spm=1001.2014.3001.5502
[2] https://blog.csdn.net/kjm13182345320/article/details/128690229