Install LibSVM in Matlab, GNU Octave and Python

Matlab and Octave are popular for machine learning prototypes due to their easier to learn (vs. R) interface. Python via scikit-learn is also a top choice for machine learning. Here’s how to install LibSVM for Matlab and GNU Octave.


apt install make git g++

Compile LibSVM

git clone

cd libsvm


Creates executables svm-train svm-predict svm-scale. Compile the Matlab/Octave and Python modules, for which the API is similar.

Compile LibSVM Matlab/Octave module

cd libsvm/matlab

Open Matlab or Octave, and from that internal Terminal, type (this uses make.m)


which creates a few .mex files. See the matlab/README for examples of using LibSVM from Matlab and Octave.

Compile LibSVM Python module

cd libsvm/python


See the python/README for examples of using LibSVM from Python.