Support Vector Machine 

SVMlight: Support Vector Machine

 
Author: Thorsten Joachims <thorsten@ls8.cs.uni-dortmund.de>
University of Dortmund, Informatik, AI-Unit
Collaborative Research Center on 'Complexity Reduction in Multivariate Data' (SFB475)
Version: 2.01
Date: 17.08.98

Overview

SVMlight is an implementation of Support Vector Machines (SVMs) in C. The main features of the program are the following: 
  • fast optimization algorithm
    • working set selection based on steepest feasible descent
    • "shrinking" heuristic
    • caching of kernel evaluations
  • handles many thousands of support vectors
  • handles several ten-thousands of training examples
  • supports standard kernel functions and lets you define your own
  • uses sparse vector representation

Description

SVMlight is an implementation of Vapnik's Support Vector Machine [Vapnik, 1995] for the problem of pattern recognition. The optimization algorithm used in SVMlight is described in [Joachims, 1998b]. The algorithm has scalable memory requirements and can handle problems with many thousands of support vectors efficiently. So far the code has mainly been used for learning text classifiers [Joachims, 1997][Joachims, 1998a], but was also tested on several image recognition tasks and a medical application. Many tasks have the property of sparse instance vectors. This implementation makes use of this property which leads to a very compact and efficient representation. 

Source Code

The source code is free for scientific use. It must not be modified and distributed without prior permission of the author. The implementation was developed on Solaris 2.5 with gcc, but compiles also on SunOS 3.1.4, Linux and Windows NT (after small modifications). The source code is available at the following location:  Please send me email and let me know that you got svm-light. I will put you on my mailing list to inform you about new versions and bug-fixes. SVMlight needs a quadratic programming tool for solving small intermediate quadratic programming problems. The current version comes with interfaces to 

Installation

To install SVMlight you need to download svm_light.tar.gz and PR_LOQO (or donlp2.tar.gz or donlp2_c.tar.gz). Create a new directory: 
    mkdir svm_light
Move svm_light.tar.gz to this directory and unpack it with 
    gunzip -c svm_light.tar.gz | tar xvf -
Depending on the optimizer you want to use 
  • PR_LOQO

  • Create a subdirectory in the svm_light directory with 
      mkdir pr_loqo 
       
    and copy the files pr_loqo.c and pr_loqo.h (which you received by email) in there. 
     
  • DONLP2

  • Copy the tar-file with DONLP2 into the svm_light directory. Unzip and untar the file with the following command: 
               
      (mkdir donlp2; cd donlp2; gunzip -c ../donlp2.tar.gz | tar xvf -; cd ..) 
               or 
      gunzip -c donlp2_c.tar.gz | tar xvf -
Now execute 
    make    or    make all
which compiles the system and creates the two executables 
    svm_learn       (learning module) 
    svm_classify    (classification module)
If the system does not compile properly, check this FAQ. You can get the f2c library from here

How to use

svm_learn is called with the following parameters: 
    svm_learn [options] example_file model_file 
     
Available options are: 
    -h          -> Help. 
    -v [0..3]   -> Verbosity level (default 2) . 
    -i [0,1]    -> Remove training examples from training set for which the 
                   upper bound C on the Lagrange multiplier is active at some 
                   point during training (default 0). After removal the SVM is 
                   trained from scratch on the remaining  examples. 
    -q [2..400] -> Maximum size of QP-subproblems (default 10). Different values 
                   may improve training speed, but do not influence the resulting 
                   classifier. 
    -h [5..]    -> number of iterations a variable needs to be 
                   optimal before considered for shrinking (default 100) 
    -f [0,1]    -> do final optimality check for variables removed 
                   by shrinking. Although this test is usually  
                   positive, there is no guarantee that the optimum 
                   was found if the test is omitted. (default 1) 
    -m [5..]    -> size of cache for kernel evaluations in MB (default 40). 
                   The larger the faster... 
    -c float    -> C: Trade-off between training error and margin (default 1000). 
    -e [1..0[   -> eps: Allow that error when fitting constraints 
                   [y [w*x+b] - 1] <= eps at KT-point (default 0.001). 
                   Larger values speed up training, but may result in a worse 
                   classifier. 
    -t int      -> Type of kernel function: 
                   0: linear K(a,b)= a*b  (default) 
                   1: polynomial K(a,b)= (s a*b+c)^d 
                   2: radial basis function K(a,b)= exp(-gamma ||a-b||^2) 
                   3: sigmoid K(a,b)= 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/polynomial kernel (default 1). 
    -r float    -> Parameter c in sigmoid/polynomial kernel (default 1). 
    -u string   -> Parameters of user defined kernel.
The input file example_file contains the training examples. The first lines may contain comments and are ignored if they start with #. Each of the following lines represents one training example and is of the following format: 
    <class> .=. +1 | -1 
    <feature> .=. integer 
    <value> .=. real 
    <line> .=. <class> <feature>:<value> <feature>:<value> ... <feature>:<value>
The class label and each of the feature/value pairs are separated by a space character. Feature/value pairs MUST be ordered by increasing feature number. Features with value zero can be skipped. 

The result of svm_learn is the model which is learned from the training data in example_file. The model is written to model_file. To classify test examples, svm_classify reads this file. svm_classify is called with the following parameters: 

    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)
All test examples in example_file are classified and the predicted classes are written to output_file. There is one line per test example in output_file containing the value of the decision function on that example. The test example file has the same format as the one for svm_learn. Additionally <class> can have the value zero indicating unknown. 

If you want to find out more, try this FAQ

Getting started: an Example Problem

You will find an example text classification problem at  Download this file into your svm_light directory and unpack it with 
    gunzip -c example1.tar.gz | tar xvf -
This will create a subdirectory example1. Documents are represented as feature vectors. Each feature corresponds to a word stem (9947 features). The task is to learn which Reuters articles are about "corporate acquisitions". There are 1000 positive and 1000 negative examples in the file train.dat.  The file test.dat contains 600 test examples. The feature numbers correspond to the line numbers in the file words. To run the example, execute the commands: 
    svm_learn example1/train.dat example1/model 
    svm_classify example1/test.dat example1/model example1/predictions
The accuracy on the test set is printed to stdout. 

Questions and Bug Reports

If you find bugs or you have problems with the code you cannot solve by yourself, please contact me via email <svm-light@ls8.cs.uni-dortmund.de>. 

Disclaimer

This software is free only for non-commercial use. It must not be modified and distributed without prior permission of the author. The author is not responsible for implications from the use of this software. 

History

V2.00 -> V2.01

  • Improved interface to PR_LOQO

V1.00 -> V2.00

  • Learning is much faster especially for large training sets.
  • Working set selection based on steepest feasible descent.
  • "Shrinking" heuristic.
  • Improved caching.
  • New solver for intermediate QPs.
  • Lets you set the size of the cache in MB.
  • Simplified output format of svm_classify.
  • Data files may contain comments.

V0.91 -> V1.00

  • Learning is more than 4 times faster.
  • Smarter caching and optimization.
  • You can define your own kernel function.
  • Lets you set the size of the cache.
  • VCdim is now estimated based on the radius of the support vectors.
  • The classification module is more memory efficient.
  • The f2c library is available from here.
  • Adaptive precision tuning makes optimization more robust.
  • Includes some small bug fixes and is more robust.

V0.9 -> V0.91

  • Fixed small bug which appears for very small C. Optimization did not converge.

References

[Joachims, 1997]        T. Joachims, Text Categorization with Support Vector 
                        Machines, LS VIII Technical Report, No. 23, University  
                        of Dortmund,1997. 
                        (postscript
  
[Joachims, 1998a]       T. Joachims, Text Categorization with Support Vector 
                        Machines, European Conference on Machine 
                        Learning (ECML),1997. 
                        (postscript

[Joachims, 1998b]       T. Joachims, Making large-Scale SVM Learning Practical,  
                        in: Advances in Kernel Methods - Support Vector Learning,  
                        B. Schölkopf and C. Burges and A. Smola, MIT-Press, 1998 
                        (postscript) 

[Vapnik, 1995]          V. Vapnik, The Nature of Statistical Learning Theory, 
                        Springer, New York, 1995. 
 

Other SVM Resources


Last modified August 6th, 1998 by Thorsten Joachims <thorsten@ls8.cs.uni-dortmund.de

 

    Diese Dokument ist nicht in deutscher Sprache vorhanden
[Internal...] [Research...] [Teaching...] [Staff...] [Funstuff...] [...Index] [...Frames Version