win7+64+MATLAB R2012a 安装使用libsvm-3.16详细步骤

详细步骤如下:

1.下载libsvm

http://www.csie.ntu.edu.tw/~cjlin/libsvm/
我的matlab版本 R2012a,我的libsvm版本3.16,系统版本是win7 64位


2.解压至指定目录

将libsvm解压至D:\Program Files\MATLAB\R2012a\toolbox下,你也可以解压至你喜欢的地方。

3.设置路径

file->set path

file-->Preferences-->general-->勾选 Enable toolbox path cache,然后点击 Update toolbox path cache


这步很重要!!否者出现 Undefined function or variable 'XXX' 等报错。

4.编译libsvm

首先在matlab设置当前目录为 D:\MATLAB\R2012a\toolbox\libsvm-3.16\matlab


在matlab命令窗口中输入
mex -setup


输入y


需要你选择编译器


再次确认自己的选择,输入y


编译器选择好了之后,用make.m编译

命令窗口输入make
可以看到新编译出4个文件libsvmread.mexw64,libsvmwrite.mexw64,svmtrain.mexw64,svmpredict.mexw64


在命令窗口中输入
load heart_scale;
此时需注意,libsvm 3.12中提供的是c++版本的数据集heart_scale,这里需要加载matlab版本的数据集。
这两个数据集有什么不同呢?

C++版本的数据集里面如果某一个样本的某一个特征为0,这个特征可以不写在数据集中,但是在matlab版本中,必须要写出来。
否则的话,会报错

此时你可以选择下载matlab型的数据集,给一个链接。
http://download.csdn.net/detail/boruoshui/4881338
然后读取数据集
load heart_scale;
完成该步骤后发现Workspace中出现了heart_scale_inst 和 heart_scale_label,说明正确。


5 测试

model=svmtrain(heart_scale_label,heart_scale_inst);
[predict_lebel,accuracy]=svmpredict(heart_scale_label,heart_scale_inst,model);


说明安装正确,可以进行下一步实验。

支持向量机源码,可在 www.csie.ntu.edu.tw/~cjlin/libsvm/ 下载到最新版本,该版本是 2013年4月更新的,3.17 版。压缩包里面有源代码和文档。以下摘自前述网站: Introduction LIBSVM is an integrated software for support vector classification, (C-SVC, nu-SVC), regression (epsilon-SVR, nu-SVR) and distribution estimation (one-class SVM). It supports multi-class classification. Since version 2.8, it implements an SMO-type algorithm proposed in this paper: R.-E. Fan, P.-H. Chen, and C.-J. Lin. Working set selection using second order information for training SVM. Journal of Machine Learning Research 6, 1889-1918, 2005. You can also find a pseudo code there. (how to cite LIBSVM) Our goal is to help users from other fields to easily use SVM as a tool. LIBSVM provides a simple interface where users can easily link it with their own programs. Main features of LIBSVM include Different SVM formulations Efficient multi-class classification Cross validation for model selection Probability estimates Various kernels (including precomputed kernel matrix) Weighted SVM for unbalanced data Both C++ and Java sources GUI demonstrating SVM classification and regression Python, R, MATLAB, Perl, Ruby, Weka, Common LISP, CLISP, Haskell, OCaml, LabVIEW, and PHP interfaces. C# .NET code and CUDA extension is available. It's also included in some data mining environments: RapidMiner, PCP, and LIONsolver. Automatic model selection which can generate contour of cross valiation accuracy.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值