chapter one: matlab高级版本中自带的svm函数
我现在使用的matlab版本为matlab 7.6.0(R2008a)这个版本中已经自带svm算法,分别为生物信息工具箱(bioinformatics toolbox)中svmclassify函数和svmtrain函数,为上下级关系。
SVMStruct=svmtrain(Training,Group)%svmtrain的输入为样本点training和样本的分类情况group,输出为一个分类器svmstruct.
核函数,核参数,和计算方法等都是可选的,如SVMStruct = svmtrain(…, ‘Kernel_Function’, Kernel_FunctionValue, …)
但是切记切记一定要成对出现。
然后,将分类器和testing sample带入svmclassify中,可以得到分类结果和准确度。
举个例子哈
svmStruct = svmtrain(data(train,:),groups(train),’Kernel_Function’,'rbf’,'Kernel_FunctionValue’,’5′,’showplot’,true);
%用了核宽为5的径向基核,且要求作图
%这里我觉得原作者的写法有误,应该是svmStruct = svmtrain(data(train,:),groups(train),...
'Kernel_Function','rbf','RBF_Sigma',5,'showplot',true);
classes = svmclassify(svmStruct,data(test,:),’showplot’,true);
%要求输出检测样本点的分类结果,且画图表示。
tip 1: 有归一化scale功能,可以通过调参数实现
tip 2: 计算方法可选qp,smo,ls
tip 3: 有个关于soft margin的盒子条件,我不太明白是干嘛的,谁懂得话,就给我讲讲哈
tip 4: 画出来的图很难看
to sum up: 挺好的
chapter two: 我最早使用的工具箱SVM and Kernel Methods Matlab Toolbox