svm_light使用介绍

svm_light下载地址http://download.joachims.org/svm_light/current/svm_light.tar.gz,下载需,童鞋们请自备利器,我用的socks5代理。

svm-light相比libsvm使用简单,只有learn和classify两个,没有scale。集成进自己的工程大致有两种方式:1.工程内部system调用两个exe;2.封装源码嵌入工程。

svm_light训练和预测使用方法参考官网how to use就ok,写的比较清楚,http://svmlight.joachims.org/

train:

svm_learn is called with the following parameters:

svm_learn [options] example_file model_file

Available options are:

General options:
         -?          - this help
         -v [0..3]   - verbosity level (default 1)
Learning options:
         -z {c,r,p}  - select between classification (c), regression (r), and 
                       preference ranking (p) (see [Joachims, 2002c])
                       (default classification)          
         -c float    - C: trade-off between training error
                       and margin (default [avg. x*x]^-1)
         -w [0..]    - epsilon width of tube for regression
                       (default 0.1)
         -j float    - Cost: cost-factor, by which training errors on
                       positive examples outweight errors on negative
                       examples (default 1) (see [Morik et al., 1999])
         -b [0,1]    - use biased hyperplane (i.e. x*w+b0) instead
                       of unbiased hyperplane (i.e. x*w0) (default 1)
         -i [0,1]    - remove inconsistent training examples
                       and retrain (default 0)
Performance estimation options:
         -x [0,1]    - compute leave-one-out estimates (default 0)
                       (see [5])
         -o ]0..2]   - value of rho for XiAlpha-estimator and for pruning
                       leave-one-out computation (default 1.0) 
                       (see [Joachims, 2002a])
         -k [0..100] - search depth for extended XiAlpha-estimator
                       (default 0)
Transduction options (see [Joachims, 1999c], [Joachims, 2002a]):
         -p [0..1]   - fraction of unlabeled examples to be classified
                       into the positive class (default is the ratio of
                       positive and negative examples in the training data)
Kernel options:
         -t int      - type of kernel function:
                        0: linear (default)
                        1: polynomial (s a*b+c)^d
                        2: radial basis function exp(-gamma ||a-b||^2)
                        3: sigmoid tanh(s a*b + c)
                        4: user defined kernel from kernel.h
         -d int      - parameter d in polynomial kernel
         -g float    - parameter gamma in rbf kernel
         -s float    - parameter s in sigmoid/poly kernel
         -r float    - parameter c in sigmoid/poly kernel
         -u string   - parameter of user defined kernel
Optimization options (see [Joachims, 1999a], [Joachims, 2002a]):
         -q [2..]    - maximum size of QP-subproblems (default 10)
         -n [2..q]   - number of new variables entering the working set
                       in each iteration (default n = q). Set n if option is given, reads alphas from file with given
                        and uses them as starting point. (default 'disabled')
         -# int      -> terminate optimization, if no progress after this
                        number of iterations. (default 100000)
Output options: 
         -l char     - file to write predicted labels of unlabeled examples 
                       into after transductive learning 
         -a char     - write all alphas to this file after learning (in the 
                       same order as in the training set)
predict:

svm_classify [options] example_file model_file output_file

Available options are:

-h         Help. 
-v [0..3]  Verbosity level (default 2).
-f [0,1]   0: old output format of V1.0
           1: output the value of decision function (default)

你可能感兴趣的:(机器学习)