MATLAB利用SVM分类和回归:[1]libsvm的安装
的有关信息介绍如下:![MATLAB利用SVM分类和回归:[1]libsvm的安装](/upload/jingyan/2025/1013/9437019c.jpg)
SVM软件包的安装
LIBSVM是行业类常用的软件包
LIBSVM的下载地址为http://pan.baidu.com/s/1qWEzoGs
点击Download 下载 zip类型的压缩文件 把文件解压,本文所解压的地方为
D:\code\libsvm-3.17
将解压的地址添加为MATLAB的目录
在MATLAB主界面点击SET PATH,点击Add With Subfolders...
添加目录进去,添加完成后save
设置MATLAB编译(本文选用VS2012)
在MATLAB命令行运行
mex -setup
出现结果为
Welcome to mex -setup. This utility will help you set up
a default compiler. For a list of supported compilers, see
http://www.mathworks.com/support/compilers/R2013a/win64.html
Please choose your compiler for building MEX-files:
Would you like mex to locate installed compilers [y]/n?
输入y
返回
Select a compiler:
Microsoft Visual C++ 2012 in C:\Program Files (x86)\Microsoft Visual Studio 11.0
None
Compiler:
选择1
Are these correct [y]/n?
再次输入y
完成
编译 libsvm
把matlab的当前目录设置成
D:\code\libsvm-3.17\matlab
运行make.m
可以看到编译出现了四个文件libsvmread.mexw32,libsvmwrite.mexw32,svmtrain.mexw32,svmpredict.mexw32
这时候找一个MATLAB版本的文件数据集
然后输入
load heart_scale;
model=svmtrain(heart_scale_label,heart_scale_inst)
[predicted_label,accuracy,decision_values]=svmpredict(heart_scale_label,heart_scale_inst,model)
可以看到accuracy=86.6667%
安装成功



