1 模型
针对支持向量机(SVM)在数据分类中,根据经验选取参数导致预测精度下降的问题,提出一种基于布谷鸟搜索算法(CSA)优化SVM的分类的新方法(CSA-SVM).先以历史负荷,温度,湿度等属性构成训练样本集的输入向量作为SVM的输入,以负荷值作为输出,建立SVM预测模型;再根据训练误差,以CSA对SVM中惩罚因子和核参数进行寻优;最后,按照CSA寻优获得的最优参数建立基于CSA-SVM的预测模型并开展数据分类.实际负荷数据试验显示,相较于SVM模型,CSA-SVM具有更高的预测精度,能够满足电力系统短期负荷预测精度需求.
1.1 支持向量机
1.2 布谷鸟算法
2 部分代码
%#ok<*SAGROW> Remove hints of syntax
%#ok<*CLALL>
%#ok<*FNDSB>
clear all ;
close all ;
clc ;
N = 25; % Number of nests(The scale of solution)
D = 10 ; % Dimensionality of solution
T = 200 ; % Number of iterations
Xmax = 20 ;
Xmin = -20 ;
Pa = 0.25 ; % Probability of building a new nest(After host bird find exotic bird eggs)
nestPop = rand(N,D)*(Xmax-Xmin)+Xmin ; % Random initial solutions
for t=1:T
levy_nestPop = func_levy(nestPop,Xmax,Xmin) ; % Generate new solutions by Levy flights
nestPop = func_bestNestPop(nestPop,levy_nestPop); % Choose a best nest among new and old nests
rand_nestPop = func_newBuildNest(nestPop,Pa,Xmax,Xmin); % Abandon(Pa) worse nests and build new nests by (Preference random walk )
nestPop = func_bestNestPop(nestPop,rand_nestPop) ; % Choose a best nest among new and old nests
[~,index] = max(func_fitness(nestPop)) ; % Best nests
trace(t) = func_objValue(nestPop(index,:)) ;
end
figure
plot(trace);
xlabel('迭代次数') ;
ylabel('适应度值') ;
title('适应度进化曲线') ;
3 仿真结果
4 参考文献
[1]胡智强等. "基于布谷鸟搜索优化支持向量机的短期负荷预测." 水电能源科学 034.012(2016):209-212.
5 MATLAB代码与数据下载地址
见博客主页