libsvm-mat-2.89-3 的用法

本文详细介绍了如何在MATLAB中安装和配置libsvm-mat-2.89-3。首先,将库复制到toolbox目录,然后设置路径。在命令行中运行`mbuild -setup`,选择手动设置Microsoft Visual C/C++ 6.0编译器的位置。确认设置后,通过运行`mex -setup`和`make`完成安装。确保所有步骤成功后,libsvm-mat即可使用。
摘要由CSDN通过智能技术生成

一定先看readme文件!!!比什么教程强多了!

 

将libvsm-mat-2.89-3拷贝到toobox中,然后set path

 

然后命令窗口输入 :

 

 

>> mbuild -setup

Please choose your compiler for building standalone MATLAB applications: 

 

Would you like mbuild to locate installed compilers [y]/n? n %我的不能自动搜索到vc,所以选择n然后进行手动设置

 

Select a compiler: 

[1] Borland C++Builder version 6.0 

[2] Borland C++Builder version 5.0 

[3] Borland C++Builder version 4.0 

[4] Borland C++Builder version 3.0 

[5] Borland C/C++ version 5.02 

[6] Borland C/C++ version 5.0 

[7] Borland C/C++ (free command line tools) version 5.5 

[8] Lcc C version 2.4 

[9] Microsoft Visual C/C++ version 7.1 

[10] Microsoft Visual C/C++ version 7.0 

[11] Microsoft Visual C/C++ version 6.0 

 

[0] None 

 

Compiler: 11

 

The default location for Microsoft Visual C/C++ compilers is C:/Program Files/Microsoft Visual Studio, 

but that directory does not exist on this machine.  

 

Use C:/Program Files/Microsoft Visual Studio anyway [y]/n? n

Please enter the location of your compiler: [C:/Program Files/Microsoft Visual Studio] d:/VC6.0 green version

 

Please verify your choices: 

 

Compiler: Microsoft Visual C/C++ 6.0 

Location: d:/VC6.0 green version 

 

Are these correct?([y]/n): y

 

Try to update options file: C:/Users/Administrator/Application Data/MathWorks/MATLAB/R14/compopts.bat 

From template:              D:/MATLAB7/BIN/WIN32/mbuildopts/msvc60compp.bat 

 

Done . . . 

 

 

--> "D:/MATLAB7/bin/win32/mwregsvr D:/MATLAB7/bin/win32/mwcomutil.dll" 

 

DllRegisterServer in D:/MATLAB7/bin/win32/mwcomutil.dll succeeded 

 

--> "D:/MATLAB7/bin/win32/mwregsvr D:/MATLAB7/bin/win32/mwcommgr.dll" 

 

DllRegisterServer in D:/MATLAB7/bin/win32/mwcommgr.dll succeeded 

 

>> mex -setup

Please choose your compiler for building external interface (MEX) files: 

 

Would you like mex to locate installed compilers [y]/n? n

 

Select a compiler: 

[1] Borland C++Builder version 6.0 

[2] Borland C++Builder version 5.0 

[3] Borland C++Builder version 4.0 

[4] Borland C++Builder version 3.0 

[5] Borland C/C++ version 5.02 

[6] Borland C/C++ version 5.0 

[7] Borland C/C++ (free command line tools) version 5.5 

[8] Compaq Visual Fortran version 6.1 

[9] Compaq Visual Fortran version 6.6 

[10] Digital Visual Fortran version 6.0 

[11] Digital Visual Fortran version 5.0 

[12] Lcc C version 2.4 

[13] Microsoft Visual C/C++ version 7.0 

[14] Microsoft Visual C/C++ version 7.1 

[15] Microsoft Visual C/C++ version 6.0 

[16] Microsoft Visual C/C++ version 5.0 

[17] WATCOM C/C++ version 11 

[18] WATCOM C/C++ version 10.6 

 

[0] None 

 

Compiler: 15

 

The default location for Microsoft Visual C/C++ compilers is C:/Program Files/Microsoft Visual Studio, 

but that directory does not exist on this machine.  

 

Use C:/Program Files/Microsoft Visual Studio anyway [y]/n? n

Please enter the location of your compiler: [C:/Program Files/Microsoft Visual Studio] d:/VC6.0 green version

 

Please verify your choices: 

 

Compiler: Microsoft Visual C/C++ 6.0 

Location: d:/VC6.0 green version 

 

Are these correct?([y]/n): y

 

Try to update options file: C:/Users/Administrator/Application Data/MathWorks/MATLAB/R14/mexopts.bat 

From template:              D:/MATLAB7/BIN/WIN32/mexopts/msvc60opts.bat 

 

Done . . . 

 

>> make

>> 

 

 

至此表示libvsm安装成功,可以运用了。

libsvm English: libsvm_options: -s svm_type : set type of SVM (default 0) 0 -- C-SVC 1 -- nu-SVC 2 -- one-class SVM 3 -- epsilon-SVR 4 -- nu-SVR -t kernel_type : set type of kernel function (default 2) 0 -- linear: u'*v 1 -- polynomial: (gamma*u'*v + coef0)^degree 2 -- radial basis function: exp(-gamma*|u-v|^2) 3 -- sigmoid: tanh(gamma*u'*v + coef0) 4 -- precomputed kernel (kernel values in training_instance_matrix) -d degree : set degree in kernel function (default 3) -g gamma : set gamma in kernel function (default 1/k) -r coef0 : set coef0 in kernel function (default 0) -c cost : set the parameter C of C-SVC, epsilon-SVR, and nu-SVR (default 1) -n nu : set the parameter nu of nu-SVC, one-class SVM, and nu-SVR (default 0.5) -p epsilon : set the epsilon in loss function of epsilon-SVR (default 0.1) -m cachesize : set cache memory size in MB (default 100) -e epsilon : set tolerance of termination criterion (default 0.001) -h shrinking: whether to use the shrinking heuristics, 0 or 1 (default 1) -b probability_estimates: whether to train a SVC or SVR model for probability estimates, 0 or 1 (default 0) -wi weight: set the parameter C of class i to weight*C, for C-SVC (default 1) -v n: n-fold cross validation mode ========================================================== Chinese: Options:可用的选项即表示的涵义如下   -s svm类型:SVM设置类型(默认0)   0 -- C-SVC   1 --v-SVC   2 – 一类SVM   3 -- e -SVR   4 -- v-SVR   -t 核函数类型:核函数设置类型(默认2)   0 – 线性:u'v   1 – 多项式:(r*u'v + coef0)^degree   2 – RBF函数:exp(-r|u-v|^2)   3 –sigmoid:tanh(r*u'v + coef0)   -d degree:核函数中的degree设置(针对多项式核函数)(默认3)   -g r(gama):核函数中的gamma函数设置(针对多项式/rbf/sigmoid核函数)(默认1/ k)   -r coef0:核函数中的coef0设置(针对多项式/sigmoid核函数)((默认0)   -c cost:设置C-SVC,e -SVR和v-SVR的参数(损失函数)(默认1)   -n nu:设置v-SVC,一类SVM和v- SVR的参数(默认0.5)   -p p:设置e -SVR 中损失函数p的值(默认0.1)   -m cachesize:设置cache内存大小,以MB为单位(默认40)   -e eps:设置允许的终止判据(默认0.001)   -h shrinking:是否使用启发式,0或1(默认1)   -wi weight:设置第几类的参数C为weight*C(C-SVC中的C)(默认1)   -v n: n-fold交互检验模式,n为fold的个数,必须大于等于2   其中-g选项中的k是指输入数据中的属性数。option -v 随机地将数据剖分为n部分并计算交互检验准确度和均方根误差。以上这些参数设置可以按照SVM的类型和核函数所支持的参数进行任意组合,如果设置的参数在函数或SVM类型中没有也不会产生影响,程序不会接受该参数;如果应有的参数设置不正确,参数将采用默认值。
Matlablibsvmmatfaruto版本Ver2-libsvm-mat-2.89-3-farutoVer2.rar libsvm-mat-2.89-3-farutoVer2 libsvm-mat-2.89-3-farutoVer2.rar 此次更新加进了,用PSO寻找SVM参数c和g的函数. 1.jpg 而且这次关于psoSVMcgForClass.m的编写,里面参数的设置采用的是用结构体的方式比较方便,这种方式我第一次采用,感觉很好..很好.. 采用这种结构体的方式可以避免过多的参数才函数接口中显示,很方便个人感觉,以前我自己没有这么编过. ANN的matlab自带的程序里面的参数设置都是采用这种手法.基本.... 程序 的一小段: function [bestCVaccuarcy,bestc,bestg,pso_option] = psoSVMcgForClass % psoSVMcgForClass % by faruto % 2009.09.22 %% 参数初始化 if nargin < 3     pso_option = struct('c1',1.5,'c2',1.7,'maxgen',200,'sizepop',20, ...                     'k',0.6,'wV',1,'wP',1,'v',3, ...                      'popcmax',10^2,'popcmin',10^,'popgmax',10^3,'popgmin',10^); end % c1:初始为1.5,pso参数局部搜索能力 % c2:初始为1.7,pso参数全局搜索能力 % maxgen:初始为200,最大进化数量 % sizepop:初始为20,种群最大数量 % k:初始为0.6,速率和x的关系 % wV:初始为1,速率更新公式中速度前面的弹性系数 % wP:初始为1,种群更新公式中速度前面的弹性系数 % v:初始为3,SVM Cross Validation参数 % popcmax:初始为100,SVM 参数c的变化的最大值. % popcmin:初始为0.1,SVM 参数c的变化的最小值. % popgmax:初始为1000,SVM 参数g的变化的最大值. % popgmin:初始为0.01,SVM 参数c的变化的最小值.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值