【lssvm回归预测】基于鸽群算法优化最小二乘支持向量机PIO-lssvm实现数据回归预测附matlab代码

简介: 【lssvm回归预测】基于鸽群算法优化最小二乘支持向量机PIO-lssvm实现数据回归预测附matlab代码

✅作者简介:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可私信。

🍎个人主页:Matlab科研工作室

🍊个人信条:格物致知。

更多Matlab仿真内容点击👇

智能优化算法  神经网络预测雷达通信 无线传感器

信号处理图像处理路径规划元胞自动机无人机 电力系统

⛄ 内容介绍

LSSVM 模型中的参数选择对模型的影响较大,采用鸽群优化算法进行模型参数的全局选优,用历史负荷数据和天气气象因素作为输入,建立优化电力负荷预测模型进行仿真.利用 PIO- LSSVM 模型对华东某市电力负荷进行验证分析.实验结果表明:鸽群算法优化的LSSVM 模型相比 LSSVM 具有更高的预测精度.

⛄ 部分代码

function [Best_vulture1_F,Best_vulture1_X,convergence_curve]=PIO(pigeonnum,max_iter,lower_bound,upper_bound,D,fobj);


%%####A new bio-inspired swarm intelligence optimizer ?C pigeon inspired

%%####optimization (PIO) is presented by simulating pigeons homing

%%####behaviors. Homing pigeons can easily find their homes by using

%%####three homing tools: magnetic field, sun and landmarks. In this  

%%#### newly invented algorithm, map and compass operator model is

%%#### presented based on magnetic field and sun, while landmark operator

%%#### model is presented based on landmarks. For some tough functions,  

%%#### it can quickly find the optimum, and it performs powerfully. For the

%%#### most important reason, it combines some advantages of algorithms

%%#### such as particle swarm optimization and artificial fish school algorithm.

%***************initialization*******************

T1=max_iter;     %Global search algebra

T2=max_iter;     %Local search algebra

% pigeonnum=30;    %number  

% D = 30;     % dimensionality

R=0.3;     %parameters of magnetic field  

bound=[lower_bound,upper_bound];    %hunting zone

tol = 1e-7;


%**************initialization of the individual pigeon************

for i=1:pigeonnum                                                           %时间复杂度O(pigeonum*D*2)

   for j=1:D

       x(i,j)=bound(1)+rand*(bound(2)-bound(1));

       v(i,j)=rand;

   end

end

%**************calculate the fitness of pigeon***********

for i=1:pigeonnum                                                           %时间复杂度O(pigeonum*2)

   p(i)=fobj(x(i,:));

   p_best(i,:)=x(i,:);

end

%**************find the optimal pigeons********************

 

g_best=x(1,:);

for i=2:pigeonnum                                                           %时间复杂度O(pigeonum-1)

   if fobj(g_best)>fobj(x(i,:))

       g_best=x(i,:);

   end

end

%************  magnetic compass and solar operator********************

for t=1:T1                                                                  %时间复杂度O(T1*(pigeonum*(2D+5))+1)

   for i=1:pigeonnum                                                       %时间复杂度O(pigeonum*(2D+5))                      

       v(i,:)=v(i,:)+rand*(p_best(i,:)-x(i,:));

       x(i,:)=x(i,:)*(1-exp(-R*t))+v(i,:);   %check whether beyond the searching space

       for j=1:D                                    % magnetic field and solar operator

           if abs(i-1)<=eps

               if x(i,j)<bound(1)||x(i,j)>bound(2)

                   x(i,j)=bound(1)+rand*(bound(2)-bound(1));

                   v(i,j)=rand;

               end

           else

               if x(i,j)<bound(1)||x(i,j)>bound(2)

                   x(i,j)=x(i-1,j);  

                   v(i,j)=v(i-1,j);

               end    

           end

       end

       if fobj(x(i,:))<p(i)                         %renewal individual fitness

           p(i)=fobj(x(i,:));

           p_best(i,:)=x(i,:);

       end

       if p(i)<fobj(g_best)                         %renewal global fitness

           g_best=p_best(i,:);

       end

   end

   result(t)=fobj(g_best);

end

%*************???????**********************

for t=1:T2                                                                  %时间复杂度O(T2*pigeonum*pigeonum)

   for i=1:pigeonnum-1                             %sort the pigeons      

       for j=i+1:pigeonnum

           if fobj(x(i,:))>fobj(x(j,:))

               temp_pigeon=x(i,:);

               x(i,:)=x(j,:);

               x(j,:)=temp_pigeon;

           end

       end

   end

   pigeonnum=ceil(pigeonnum/2);               %remove half of the pigeons according to the landmark

   addpigeonnum=0;                        

   for i=1:pigeonnum

       addpigeonnum=addpigeonnum+x(i,:);      

       p(i)=fobj(x(i,:));                     %calculate fitness and location of the pigeon after sorting

       p_best(i,:)=x(i,:);

   end

   pigeoncenter=ceil(addpigeonnum./pigeonnum);%calculate central position

   for i=1:pigeonnum                                %local searching        

       for j=1:D                                    %check whether beyond the searching space

           x(i,j) = x(i,j) + rand*(pigeoncenter(j)-x(i,j));

           while x(i,j)<bound(1)||x(i,j)>bound(2)

               x(i,j) = x(i,j) + rand*(pigeoncenter(j)-x(i,j));

           end

       end

       if fobj(x(i,:))<p(i)                         %renewal individual fitness

           p(i)=fobj(x(i,:));

           p_best(i,:)=x(i,:);

       end

       if p(i)<fobj(g_best)                         %renewal global fitness

           g_best=p_best(i,:);

       end

   end

   result(t+T1)=fobj(g_best);

end


% figure                                               %graph

% for t=1:T1+T2-1

%     plot([t,t+1],[result(t),result(t+1)]);

%     hold on;

% end

% xlabel('Iterative curve');

% ylabel('Function value');

% title(['The best value is ' num2str()])

[Best_vulture1_F,indx]=min(result);

Best_vulture1_X=g_best;

convergence_curve=result;

end

⛄ 运行结果

⛄ 参考文献

[1]鞠彬王嘉毅. 基于粒子群算法与最小二乘支持向量机的ET0模拟[J]. 水资源保护, 2016, 32(4):74-79.

[2]吴文江, 陈其工, and 高文根. "基于 PSO 优化参数的最小二乘支持向量机短期负荷预测." 重庆理工大学学报(自然科学版) 030.003(2016):112-115.

⛄ Matlab代码关注

❤️部分理论引用网络文献,若有侵权联系博主删除
❤️ 关注我领取海量matlab电子书和数学建模资料


相关文章
|
7月前
|
机器学习/深度学习 算法 前端开发
别再用均值填充了!MICE算法教你正确处理缺失数据
MICE是一种基于迭代链式方程的缺失值插补方法,通过构建后验分布并生成多个完整数据集,有效量化不确定性。相比简单填补,MICE利用变量间复杂关系,提升插补准确性,适用于多变量关联、缺失率高的场景。本文结合PMM与线性回归,详解其机制并对比效果,验证其在统计推断中的优势。
1765 11
别再用均值填充了!MICE算法教你正确处理缺失数据
|
8月前
|
传感器 机器学习/深度学习 算法
【使用 DSP 滤波器加速速度和位移】使用信号处理算法过滤加速度数据并将其转换为速度和位移研究(Matlab代码实现)
【使用 DSP 滤波器加速速度和位移】使用信号处理算法过滤加速度数据并将其转换为速度和位移研究(Matlab代码实现)
523 1
|
8月前
|
存储 监控 算法
企业电脑监控系统中基于 Go 语言的跳表结构设备数据索引算法研究
本文介绍基于Go语言的跳表算法在企业电脑监控系统中的应用,通过多层索引结构将数据查询、插入、删除操作优化至O(log n),显著提升海量设备数据管理效率,解决传统链表查询延迟问题,实现高效设备状态定位与异常筛选。
211 3
|
7月前
|
机器学习/深度学习 人工智能 算法
【基于TTNRBO优化DBN回归预测】基于瞬态三角牛顿-拉夫逊优化算法(TTNRBO)优化深度信念网络(DBN)数据回归预测研究(Matlab代码实现)
【基于TTNRBO优化DBN回归预测】基于瞬态三角牛顿-拉夫逊优化算法(TTNRBO)优化深度信念网络(DBN)数据回归预测研究(Matlab代码实现)
319 0
|
7月前
|
机器学习/深度学习 算法 机器人
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
【水下图像增强融合算法】基于融合的水下图像与视频增强研究(Matlab代码实现)
724 0
|
7月前
|
算法 定位技术 计算机视觉
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
【水下图像增强】基于波长补偿与去雾的水下图像增强研究(Matlab代码实现)
954 0
|
7月前
|
算法 机器人 计算机视觉
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
【图像处理】水下图像增强的颜色平衡与融合技术研究(Matlab代码实现)
246 0
|
7月前
|
新能源 Java Go
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
【EI复现】参与调峰的储能系统配置方案及经济性分析(Matlab代码实现)
260 0
|
7月前
|
机器学习/深度学习 算法 机器人
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
使用哈里斯角Harris和SIFT算法来实现局部特征匹配(Matlab代码实现)
347 8
|
7月前
|
机器学习/深度学习 编解码 算法
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
基于OFDM技术的水下声学通信多径信道图像传输研究(Matlab代码实现)
349 8

热门文章

最新文章