kevin19821 发表于 2007-11-11 20:31

支持向量机使用例子

clc
clear
load guzhangshuju.mat;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% aa=eye(6,6);
%   for i=1:6
%    for j=1:5
%      mubiao11(j+5*(i-1),:)=aa(i,:);
%    end
% end
%%对输入样本进行归一化处理;
hehehe=ans';
%hehehe=;
max1=max(hehehe);
%   hehehe=;
for i=1:100
   hehehe(:,i)= hehehe(:,i)/max1(i);
end
hehehe=hehehe';
% %%用神经网络分类识别
pp=,:); hehehe(,:);hehehe(,:);hehehe(,:);hehehe(,:);hehehe(,:);hehehe(,:)];
jiance=,:);hehehe(,:);hehehe(,:); hehehe(,:);hehehe(,:);hehehe(,:);hehehe(,:)];
%%用BP网络进行训练;
%net=newff(minmax(pp'),,{'tansig','purelin'});
%net.trainParam.epochs=75;
%net.trainParam.goal=0.001;
%net=train(net,pp',mubiao11');
%tt=sim(net,pp');
%%%%%%%%%%%%%%%%%%%%%%%%%%
% spread=12;
% net=newrbe(pp',mubiao11',spread);
% %%样本的检测;
% tt=sim(net,jiance');
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%svm进行识别
%%用6个SVM对信号进行分类
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%第一个svm1
X1=pp;
Y1=;
gam=30;
sig2=2;
=trainlssvm({X1,Y1','c',gam,sig2});
%%第二个svm2
X2=,:);hehehe(,:);hehehe(,:);hehehe(,:);hehehe(,:);hehehe(,:)];
Y2=;
=trainlssvm({X2,Y2','c',gam,sig2});
%%第三svm3
X3=,:);hehehe(,:);hehehe(,:);hehehe(,:);hehehe(,:)];
Y3=;
=trainlssvm({X3,Y3','c',gam,sig2});
%%第四个svm4
X4=,:);hehehe(,:);hehehe(,:);hehehe(,:)];
Y4=;
=trainlssvm({X4,Y4','c',gam,sig2});
%%第五个svm5
X5=,:);hehehe(,:);hehehe(,:)];
Y5=;
=trainlssvm({X5,Y5','c',gam,sig2});
%%第六个svm6
X6=,:);hehehe(,:)];
Y6=;
=trainlssvm({X6,Y6','c',gam,sig2});
% %%第七个svm6
% X6=,:);hehehe(,:);hehehe(,:);hehehe(,:)];
% Y6=;
% =trainlssvm({X6,Y6','c',gam,sig2});
% %%第八个svm6
% X6=,:);hehehe(,:);hehehe(,:)];
% Y6=;
% =trainlssvm({X6,Y6','c',gam,sig2});
% %%第九个svm6
% X6=,:);hehehe(,:)];$
% Y6=;
% =trainlssvm({X6,Y6','c',gam,sig2});
%将训练好的svm用于样本的检测
Yhs1=simlssvm({X1,Y1','c',gam,sig2},{alpha1,b1},jiance);
%%将非正的用svm2检测;该程序要查看后才能确定下一检测的个数;
Yhs2=simlssvm({X2,Y2','c',gam,sig2},{alpha2,b2},jiance(,:));
%%将非正的用svm3检测;该程序要查看后才能确定下一检测的个数;
Yhs3=simlssvm({X3,Y3','c',gam,sig2},{alpha3,b3},jiance(,:));
%%将非正的用svm3检测;该程序要查看后才能确定下一检测的个数;
Yhs4=simlssvm({X4,Y4','c',gam,sig2},{alpha4,b4},jiance(,:));
%%将非正的用svm3检测;该程序要查看后才能确定下一检测的个数;
Yhs5=simlssvm({X5,Y5','c',gam,sig2},{alpha5,b5},jiance(,:));
%%将非正的用svm3检测;该程序要查看后才能确定下一检测的个数;
Yhs6=simlssvm({X6,Y6','c',gam,sig2},{alpha6,b6},jiance(,:));

lingyunzhi 发表于 2008-9-16 16:23

回复 楼主 kevin19821 的帖子

guzhangshuju.mat; 里面存储的是什么数据格式呢?

gaozhihua 发表于 2008-10-13 22:40

guzhangshuju.mat;导入后在哪里用到了???

暴风雨后的宁静 发表于 2009-2-24 16:27

还是不清楚,唉

myfond 发表于 2009-3-9 10:29

回复 楼主 kevin19821 的帖子

请问gam=30;sig2=2;参数是如何确定的?是不是最优

zhuxiaoxun 发表于 2009-3-16 10:04

新手上路,哪位高手有带有注释的SVM实用程序啊?
急切等待中...
页: [1]
查看完整版本: 支持向量机使用例子