一、SVM下载
http://see.xidian.edu.cn/faculty/chzheng/bishe/indexfiles/indexl.htm二、在MATLAB中添加svm工具箱
参考:
http://jingyan.baidu.com/article/a501d80cf764c3ec630f5ef5.htm1、首先需要MATLAB SVM Toolbox,将其中的文件解压并命名为svm
2、将文件拷到E:\matlab\toolbox (我的是在E:\MATLAB\R2013a\toolbox)
3、打开matlab点击set path---->add folder 然后把你的工具箱文件夹添加进去就可以了
4、路径加进去后在file→Preferences→General的Toolbox Path Caching里点击update Toolbox Path Cache更新一下。
5、最后在matlab的命令栏中输入which svcoutput可以查看路径E:\matlab\toolbox\svm\svcoutput.m就可以了
三、如何使用SVM
原文地址:
http://blog.sina.com.cn/s/blog_5bd2cb260100eo2y.html1,下载SVM工具箱:http://see.xidian.edu.cn/faculty/chzheng/bishe/indexfiles/indexl.htm
2,安装到matlab文件夹中
3,用SVM做分类的使用方法
Support Vector Classification
_____________________________
Constructing ...
Optimising ...
Execution time:
Status : OPTIMAL_SOLUTION
|w0|^2
Margin
Sum alpha : 0.418414
Support Vectors : 3 (3.0%)
nsv =
alpha =
predictedY =
X和Y为数据,m*n:m为样本数,n为特征向量数
比如:取20组训练数据X,10组有故障,10组无故障的,每个训练数据有13个特征参数,则m=20,n=13
Y为20*1的矩阵,其中,10组为1,10组为-1.
对于测试数据中,如果取6组测试数据,3组有故障,3组无故障的,则m=6,n=13
Y中,m=6,n=1
四、在Matlab中最初使用SVM出现的问题
原文地址:http://www.ilovematlab.cn/thread-265034-1-1.html
看到论坛有很多人问这个问题[1],其实出现这个问题的根本原因是:matlab 5.X 的qp函数在matlab 6.0以上版本被quadprog函数取代[2].
解决办法:
[alpha lambda how] = quadprog(H, c, A, b, [], [], vlb, vub, x0, neqcstr);
替换svc函数中的72行: [alpha lambda how] = qp(H, c, A, b, vlb, vub, x0, neqcstr);