编程语言
首页 > 编程语言> > 【SVM分类】基于布谷鸟算法优化实现SVM数据分类matlab源码

【SVM分类】基于布谷鸟算法优化实现SVM数据分类matlab源码

作者:互联网

一、神经网络-支持向量机

支持向量机(Support Vector Machine)是Cortes和Vapnik于1995年首先提出的,它在解决小样本、非线性及高维模式识别中表现出许多特有的优势,并能够推广应用到函数拟合等其他机器学习问题中。 1 数学部分 1.1 二维空间 ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ ​​ 2 算法部分 ​​ ​​ ​​ 

二、布谷鸟算法

布谷鸟算法是布谷鸟育雏行为和萊维飞行结合的一种算法 。
这里写图片描述
在CS算法中,有两个路径(或者说成是两个位置的更新)备受关注:

CS算法的执行过程如下:
这里写图片描述

三、代码

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('适应度进化曲线') ;


在这里插入图片描述

5.参考文献:

书籍《MATLAB神经网络43个案例分析》

完整代码下载或者仿真咨询https://www.cnblogs.com/ttmatlab/p/14882966.html

 

标签:SVM,分类,算法,源码,nestPop,func,Xmin,new,nests
来源: https://www.cnblogs.com/matlabxiao/p/15058643.html