PSO |
您所在的位置:网站首页 › 用pso算法优化svm › PSO |
粒子群算法优化LSSVM
load regressionData.mat; output = output'; %划分数据集 [value,index] = sort(rand(1,2000)); x_train = input(index(1:1800),:); x_test = input(index(1801:2000),:); y_train = output(index(1:1800),:); y_test = output(index(1801:2000),:); %PSO参数 c1 = 2; %PSO局部搜索能力 c2 = 2; %PSO全局搜索能力 sizepop = 20; %种群规模 k = 100; %最大迭代次数 w = 0.9 %惯性因子 %确定优化参数的数目 length = 2; param = rand(sizepop,length); speed = rand(sizepop,length); popmin = 0.01; popmax = 100; vmin = -1; vmax = 1; for i=1:sizepop gamma = param(i,1); sig2 = param(i,2); [alpha,b] = trainlssvm({x_train,y_train,'function estimation',gamma,sig2,'RBF_kernel' |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |