Matlab 2015a 安装libsvm 3.21 步骤
2016-03-23 20:54
232 查看
安装前要先安装Microsoft Visual C++ 6.0编译器或 visual studio (我安装的是VS2010).有人安装VS2013没有安装成功,估计Matlab版本太低。
1、下载libsvm 3.21,下载地址http://www.csie.ntu.edu.tw/~cjlin/libsvm/。
2、将工具包放到任何地方均可,将工具包添加到Matlab的搜索路径。Set Path->add with subfolders->save
3、编译。mex -setup 注意:mex后要有空格,然后再是-。会有以下提示
mex -setup
MEX configured to use 'Microsoft Visual C++ 2010 (C)' for C language compilation.
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.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
(我第一次编译出现了mex 不存在之类的警告,是因为VS安装后没有重启Matlab)
这时你需要用鼠标点击 mex -setup C++.或者输入mex -setup C++,之后会出现
MEX configured to use 'Microsoft Visual C++ 2010' for C++ language compilation.
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.
4、编译文件 make
Matlab工作目录进入到libsvm-3.21/matlba,输入make
Building with 'Microsoft Visual C++ 2010 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2010 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2010'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2010'.
MEX completed successfully.
看到这个结果说明编译成功。
5、检查SVM是否安装成功
在libsvm-3.21可以看到hear_scale 文件,在命令行输入下面几行代码
clear;
[label_vector, instance_matrix] =libsvmread('heart_scale');
model = svmtrain(label_vector, instance_matrix);
[predicted_label, accuracy, prob_estimates] = svmpredict(label_vector, instance_matrix, model, 'b');
运行成功之后的结果
*
optimization finished, #iter = 162
nu = 0.431029
obj = -100.877288, rho = 0.424462
nSV = 132, nBSV = 107
Total nSV = 132
Accuracy = 86.6667% (234/270) (classification)
1、下载libsvm 3.21,下载地址http://www.csie.ntu.edu.tw/~cjlin/libsvm/。
2、将工具包放到任何地方均可,将工具包添加到Matlab的搜索路径。Set Path->add with subfolders->save
3、编译。mex -setup 注意:mex后要有空格,然后再是-。会有以下提示
mex -setup
MEX configured to use 'Microsoft Visual C++ 2010 (C)' for C language compilation.
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.
To choose a different language, select one from the following:
mex -setup C++
mex -setup FORTRAN
(我第一次编译出现了mex 不存在之类的警告,是因为VS安装后没有重启Matlab)
这时你需要用鼠标点击 mex -setup C++.或者输入mex -setup C++,之后会出现
MEX configured to use 'Microsoft Visual C++ 2010' for C++ language compilation.
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.
4、编译文件 make
Matlab工作目录进入到libsvm-3.21/matlba,输入make
Building with 'Microsoft Visual C++ 2010 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2010 (C)'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2010'.
MEX completed successfully.
Building with 'Microsoft Visual C++ 2010'.
MEX completed successfully.
看到这个结果说明编译成功。
5、检查SVM是否安装成功
在libsvm-3.21可以看到hear_scale 文件,在命令行输入下面几行代码
clear;
[label_vector, instance_matrix] =libsvmread('heart_scale');
model = svmtrain(label_vector, instance_matrix);
[predicted_label, accuracy, prob_estimates] = svmpredict(label_vector, instance_matrix, model, 'b');
运行成功之后的结果
*
optimization finished, #iter = 162
nu = 0.431029
obj = -100.877288, rho = 0.424462
nSV = 132, nBSV = 107
Total nSV = 132
Accuracy = 86.6667% (234/270) (classification)
相关文章推荐
- C/C++下调用matlab函数操作说明
- 绘制二元函数z=f(x,y)=(x^2-2*x)*exp(-x^2-y^2-x*y)的曲线及其三视图和三维表面图形
- 用鼠标左键绘制折线,利用鼠标中键或右键终止绘制
- 利用MATLAB绘制隐函数f(x,y)=x^2 * sin(x+y^2)+y^2 * exp(x+y)+5 * cos(x^2+y)=0的曲线
- 张量的展开与matlab下的工具包操作
- Matlab diff std setdiff exist
- MATLAB-Direct access of structure fields returned by a function call is not allowed 的解决方法~
- MATLAB中添加新的工具箱
- Matlab 2014a添加桌面快捷方式(ubuntu14.04 kylin)
- LIBSVM在MATLAB中的使用及SVM最优参数选取示例代码
- 每天学一点MATLAB函数——软件操作函数
- Matlab中保存图像时,图形窗口大小的控制
- 每天学一点MATLAB函数——文件编程函数
- Matlab中存储及读取数据
- matlab中textread 函数
- matlab中读取txt数据文件(txt文本文档)
- matlab 读取txt文件数据
- matlab中循环保存数据
- Matlab dir函数
- [R and Matlab] Add or delete multi-line comments