SVM相关资源汇总[matlab-libsvm-class-regress](by faruto)
SVM相关资源汇总[matlab-libsvm-class-regress](by faruto) ----关于SVM的那点破事 by faruto 可以了,终于可以完结了!这帖子我编辑过n次,不断的往里面添加东西,我想今晚可能是我最后一次编辑这个帖子.在这个帖子里面您可以找到如下和SVM相关的东西.1.关于SVM的工具箱-libsvm-mat (1)本帖子中的所有资源所使用的SVM的工具箱是libsvm-mat,没有使用其他的SVM工具箱,我坚信把这一个SVM的工具箱研究的透彻就够了,反正我是够用了! (2)关于libsvm-mat的安装的问题,你可以看下面的Q&A,也可以下载相应的我制作的SVM的视频 (3)关于libsvm-mat工具箱本身的使用问题,几乎所有的疑问你都可以找到答案~ (4)关于libsvm-mat版本更新的问题,林智仁官方的最新版本是:libsvm-mat-2.89-3,在下面你可以找到下载的链接,官方网页上的链接有问题,我是向林直接要的.还有一个faruto版本的libsvm,最新的是[farutoFinalVersion],我在里面加进了各种SVM参数优化的子函数,方便使用.在下面亦有下载链接.2.关于SVM的理论相关的.在下面提供了一些资源和paper, ppt,pdf,虽然这几个资源是有限的,但我敢说足够了.原因有两个:a.下面的几个文献本身质量就很高.b.这些文献主要的SVM的参考文献已经几乎全部列出了,你可以寻径查找.3.关于......====================================================================几乎 (almost everyone)关于你想问的有关libsvm的所有问题在这个帖子中都有答案.so请详细阅读此帖子后.若你的问题找不到答案,再发帖~farutoUltimateVersion2.0就是最后的版本号了。我不会再更新啦~大家就下载这个版本的就可以啦。虽说近期也有一些更新和优化,但整体都是在这个的基础上啦。====================另 libsvm-mat-farutoversion 版本更新历史[版本号有点乱大家别介意.O(∩_∩)O]:farutoUltimateVersion1.0:2009.10.28libsvm-mat-2.89-3-[farutoFinalVersion+pca]:2009.10.28libsvm-mat-2.89-3-[farutoFinalVersion]:2009.10.08libsvm-mat-2.89-3-farutoVer2:2009.09.23libsvm-mat-2.89-3-farutoVer1:2009.08.27============欢迎您购买 《MATLAB 神经网络30个案例分析》(我是作者之一)SVM是该书的内容之一购买方式:MATLAB 神经网络30个案例分析——目录与该书配套的有该加强工具箱的详细的使用视频:SVM讲解视频汇总[by faruto]================强烈建议您再发有关libsvm的问题前,看一下Q&A大多数的问题您在那里就会找到答案~~O(∩_∩)O========================SVM入门精品讲解系列 十连弹=======================SVM视频===============================http://www.ilovematlab.cn/thread-59483-1-1.html=========SVM其他相关链接==========================================================================SVM工具箱快速入手简易教程(by faruto)最近发现好多朋友有关SVM的工具箱的使用方法相关的东西,其实帮助文件里都有的[无论是matlab自带的还是libsvm都是有帮助文件的而且写的也明确,但还是有朋友问问],无奈我就写一个小简易的上手的教程,事先声明只给菜鸟写的,高手就不要看了,其实帮助文件里都有,你也可以看帮助文件,不用看我的.O(∩_∩)O..一. matlab 自带的函数(matlab帮助文件里的例子)[只有较新版本的matlab中有这两个SVM的函数]=====svmtrain svmclassify=====简要语法规则====svmtrainTrain support vector machine classifierSyntaxSVMStruct = svmtrain(Training, Group)SVMStruct = svmtrain(..., 'Kernel_Function', Kernel_FunctionValue, ...)SVMStruct = svmtrain(..., 'RBF_Sigma', RBFSigmaValue, ...)SVMStruct = svmtrain(..., 'Polyorder', PolyorderValue, ...)SVMStruct = svmtrain(..., 'Mlp_Params', Mlp_ParamsValue, ...)SVMStruct = svmtrain(..., 'Method', MethodValue, ...)SVMStruct = svmtrain(..., 'QuadProg_Opts', QuadProg_OptsValue, ...)SVMStruct = svmtrain(..., 'SMO_Opts', SMO_OptsValue, ...)SVMStruct = svmtrain(..., 'BoxConstraint', BoxConstraintValue, ...)SVMStruct = svmtrain(..., 'Autoscale', AutoscaleValue, ...)SVMStruct = svmtrain(..., 'Showplot', ShowplotValue, ...)---------------------svmclassifyClassify data using support vector machineSyntaxGroup = svmclassify(SVMStruct, Sample)Group = svmclassify(SVMStruct, Sample, 'Showplot', ShowplotValue)============================实例研究====================load fisheriris%载入matlab自带的数据[有关数据的信息可以自己到UCI查找,这是UCI的经典数据之一],得到的数据如下图:tu1[attach]24862[/attach]其中meas是150*4的矩阵代表着有150个样本每个样本有4个属性描述,species代表着这150个样本的分类.data = [meas(:,1), meas(:,2)];%在这里只取meas的第一列和第二列,即只选取前两个属性.groups = ismember(species,'setosa');%由于species分类中是有三个分类:setosa,versicolor,virginica,为了使问题简单,我们将其变为二分类问题:Setosa and non-Setosa.[train, test] = crossvalind('holdOut',groups);cp = classperf(groups);%随机选择训练集合测试集[有关crossvalind的使用请自己help一下]其中cp作用是后来用来评价分类器的.svmStruct = svmtrain(data(train,:),groups(train),'showplot',true);%使用svmtrain进行训练,得到训练后的结构svmStruct,在预测时使用.训练结果如图:tu2[attach]24863[/attach]classes = svmclassify(svmStruct,data(test,:),'showplot',true);%对于未知的测试集进行分类预测,结果如图:tu3[attach]24864[/attach]classperf(cp,classes,test);cp.CorrectRateans = 0.9867%分类器效果测评,就是看测试集分类的准确率的高低.二.台湾林智仁的libsvm工具箱该工具箱下载[libsvm-mat-2.86-1]:[attach]24867[/attach]安装方法也很简单,解压文件,把当前工作目录调整到libsvm所在的文件夹下,再在set path里将libsvm所在的文件夹加到里面.然后在命令行里输入mex -setup %选择一下编译器make 这样就可以了.建议大家使用libsvm工具箱,这个更好用一些.可以进行分类[多类别],预测....=========svmtrainsvmpredict================简要语法:Usage=====matlab> model = svmtrain(training_label_vector, training_instance_matrix [, 'libsvm_options']); -training_label_vector: An m by 1 vector of training labels (type must be double). -training_instance_matrix: An m by n matrix of m training instances with n features. It can be dense or sparse (type must be double). -libsvm_options: A string of training options in the same format as that of LIBSVM.matlab> [predicted_label, accuracy, decision_values/prob_estimates] = svmpredict(testing_label_vector, testing_instance_matrix, model [, 'libsvm_options']); -testing_label_vector: An m by 1 vector of prediction labels. If labels of test data are unknown, simply use any random values. (type must be double) -testing_instance_matrix: An m by n matrix of m testing instances with n features. It can be dense or sparse. (type must be double) -model: The output of svmtrain. -libsvm_options: A string of testing options in the same format as that of LIBSVM.Returned Model Structure========================实例研究:load heart_scale.mat%工具箱里自带的数据如图:tu4[attach]24873[/attach]其中 heart_scale_inst是样本,heart_scale_label是样本标签model = svmtrain(heart_scale_label, heart_scale_inst, '-c 1 -g 0.07');%训练样本,具体参数的调整请看帮助文件[predict_label, accuracy, dec_values] = svmpredict(heart_scale_label, heart_scale_inst, model);%分类预测,这里把训练集当作测试集,验证效果如下:>> [predict_label, accuracy, dec_values] = svmpredict(heart_scale_label, heart_scale_inst, model); % test the training dataAccuracy = 86.6667% (234/270) (classification)==============这回把SVM这点入门的东西都说完了,大家可以参照着上手了,有关SVM的原理我下面有个简易的PPT,是以前做项目时我做的[当时我负责有关SVM这一块代码实现讲解什么的],感兴趣的你可以看看,都是上手较快的东西,想要深入学习SVM,你的学习统计学习理论什么的....挺多的呢..[attach]24876[/attach]-----------有关SVM和libsvm的非常好的资料,想要详细研究SVM看这个------[attach]32035[/attach][attach]32036[/attach][attach]32037[/attach][attach]32038[/attach]其中那个林智仁06年机器学习暑期学校讲义pdf是 matlab@man提供的[]图:[attach]32039[/attach][attach]32040[/attach][attach]32041[/attach][attach]32042[/attach]