Install SVM-light for R

SVMlight is an implementation of the Support Vector Machine providing methods for efficient estimation methods for both error rate and precision/recall. SVMlight exploits that the results of most leave-one-outs (often more than 99%) are predetermined and need not be computed. Further more it can also train SVMs with cost models. 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.

The R package klaR makes the implementation available with almost the same interface as other common packages like e1071. For klaR to work svm-light needs to be installed separately.

The binaries need to be downloaded here and placed into the PATH of the user. Here for example the binaries are placed into the bin folder of the user.

$ cp ~/Downloads/svm_light_osx.8.4_i7.tar.gz ~/bin/
$ tar xfz svm_light_osx.8.4_i7.tar.gz
$ cd ~/Downloads/
$ mkdir svm_light
$ mv svm_learn svm_classify svm_light/

Add last we need to add the svm_learn and svm_classify to the PATH of the user.

$ export PATH=$PATH:/Users/hkropp/bin/svm_light

Running the example:

> install.packages('klaR')
> library('klaR')
> data(iris)
> x <- svmlight(Species ~ ., data = iris)

Further Readings


One thought on “Install SVM-light for R

  1. Hi, I would like to know if this procedure still works! I tried but couldn’t execute the example. Getting this error: “sh: svm_learn: command not found
    Error in file(con, “r”) : cannot open the connection”


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s