1.Matlab实现QPSO-SVM、PSO-SVM、SVM分类预测对比,运行环境Matlab2018b及以上;
2.Matlab实现QPSO-SVM(量子粒子群优化支持向量机)、PSO-SVM(粒子群优化支持向量机)、SVM(支持向量机)分类预测对比。
3.多特征输入单输出的二分类及多分类模型。程序内注释详细,直接替换数据就可以用;
4.程序语言为matlab,程序可出分类效果图,迭代优化图,混淆矩阵图;
main为主程序,其余为函数文件,无需运行,可在下载区获取数据和程序内容。
pop(j,:)=pop(j,:)+V(j,:);
if isempty(find(pop(j,:)>popmax))
;
else
loc = find(pop(j,:)>popmax);
pop(j,find(pop(j,:)>popmax))=popmax(find(pop(j,:)>popmax));
end
if isempty(find(pop(j,:)<popmin))
;
else
loc = find(pop(j,:)<popmin);
pop(j,find(pop(j,:)<popmin))=popmin(find(pop(j,:)<popmin));
end
%适应度值
fitness(j)=SVMcgForClass(t_train,pn_train,pop(j,1),pop(j,2),v,bestnum);
end
for j=1:sizepop
%个体最优更新
if fitness(j) > fitnessgbest(j)
gbest(j,:) = pop(j,:);
fitnessgbest(j) = fitness(j);
end
%群体最优更新
if fitness(j) > fitnesszbest
zbest = pop(j,:);
fitnesszbest = fitness(j);
end
end
yy(i)=fitnesszbest;
end
end
end
%%%%%%%%%%%按照公式依次迭代直到满足精度或者迭代次数%%%%%%%%%%%%%
for i=1:T
i
for j=1:N
%%%%%%%%%%%%%%更新个体最优位置和最优值%%%%%%%%%%%%%%%%%
if (fobj(x(j,:))) <pbest(j)
p(j,:)=x(j,:);
pbest(j)=fobj(x(j,:));
[1] https://blog.csdn.net/kjm13182345320/article/details/129036772?spm=1001.2014.3001.5502
[2] https://blog.csdn.net/kjm13182345320/article/details/128690229