开发者

traning data sets using libsvm on windows

Do you know a 开发者_Go百科simple example using libsvm, I have Windows 7 installed.

  • so I start a console, and....


grid.py is a model selection tool for C-SVM classification using RBF (radial basis function) kernel. It uses cross validation (CV) technique to estimate the accuracy of each parameter combination in the specified range and helps you to decide the best parameters for your problem.

grid.py directly executes libsvm binaries (so no python binding is needed) for cross validation and then draw contour of CV accuracy using gnuplot. You must have libsvm and gnuplot installed before using it. The package gnuplot is available at http://www.gnuplot.info/

Usage: grid.py [-log2c begin,end,step] [-log2g begin,end,step] [-v fold] 
       [-svmtrain pathname] [-gnuplot pathname] [-out pathname] [-png pathname]  
       [additional parameters for svm-train] dataset

The program conducts v-fold cross validation using parameter C (and gamma) = 2^begin, 2^(begin+step), ..., 2^end.

You can specify where the libsvm executable and gnuplot are using the -svmtrain and -gnuplot parameters.

For windows users, please use pgnuplot.exe. If you are using gnuplot
3.7.1, please upgrade to version 3.7.3. The version 3.7.1 has a bug.

Example

> python grid.py -log2c -5,5,1 -log2g -4,0,1 -v 5 -m 300 heart_scale

Users (in particular MS Windows users) may need to specify the path of executable files. You can either change paths in the beginning of grid.py or specify them in the command line. For example,

> grid.py -log2c -5,5,1 -svmtrain c:\libsvm-2.7\windows\svmtrain.exe -gnuplot c:\tmp\gnuplot\bin\pgnuplot.exe -v 10 heart_scale

Output: two files dataset.png: the contour plot of the CV accuracy (generated by gnuplot) dataset.out: the log of accuracy at each (C,gamma)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜