libsvm在matlab_R2014中的安装

来源:互联网 发布:粒子群算法应用实例 编辑:程序博客网 时间:2024/06/05 14:37

此处先附上前辈的详解 http://www.matlabsky.com/thread-11925-1-1.html
以及libsvm库下载 http://www.csie.ntu.edu.tw/~cjlin/libsvm/

但在详解中由于用的matlab 较低版本
在第二步:mex -up步骤中
即使电脑中安装了VS R2014版本不会提示你选择编译器

>> mex -setupMEX 配置为使用 'Microsoft Visual C++ 2013 Professional (C)' 以进行 C 语言编译。Warning: The MATLAB C and Fortran API has changed to support MATLAB     variables with more than 2^32-1 elements. In the near future     you will be required to update your code to utilize the     new API. You can find more information about this at:     http://www.mathworks.com/help/matlab/matlab_external/upgrading-mex-files-to-use-64-bit-api.html.要选择不同的语言,请从以下选项中选择一种命令: mex -setup C++  mex -setup FORTRAN

在这个时候不用惊慌高版本的matlab实际会自动寻找这个编译器,故只需

>> help  matlab

matlab 的内容:
make - This make.m is for MATLAB and OCTAVE under Windows, Mac, and Unix

 >> make

使用 ‘Microsoft Visual C++ 2013 Professional (C)’ 编译。
MEX 已成功完成。
使用 ‘Microsoft Visual C++ 2013 Professional (C)’ 编译。
MEX 已成功完成。

接下来我们再测试一下:

>> load heart_scale;model = svmtrain(heart_scale_label,heart_scale_inst);[predict_label,accuracy] = svmpredict(heart_scale_label,heart_scale_inst,model);

如果结果出现

optimization finished, #iter = 162nu = 0.431029obj = -100.877288, rho = 0.424462nSV = 132, nBSV = 107Total nSV = 132Accuracy = 86.6667% (234/270) (classification)

恭喜你就安装成功啦

0 0
原创粉丝点击