How to set up LIBSVM Matlab interface?

ARAT picture ARAT · Dec 19, 2012 · Viewed 13k times · Source

I am having problem with implementing LibSVM to MATLAB. I am using MATLAB R2009a (I also have the latest version, R2012b, but I dont use that one) I downloaded LibSVM package, libsvm-3.14 to my Windows 7 PC, which MATLAB and OCTAVE interface come together.

I extracted the folder I downloaded. Which, below, you can see the printscreen of what the folder has in.enter image description here

Where should I put my libsvm-3.14 extracted folder ? Should I put it under "bin" folder of my MATLAB installed in the directory?

C:\Program Files\MATLAB\R2009a\bin

I did that, however, it didn't work out. I will be grateful if you help me clearly. I just read README file, but it's not clear to understand and there is no other instructions online on the internet.

Answer

user1284631 picture user1284631 · Dec 19, 2012

For the time being, it does not matter where you put that folder. You'll have to compile the Matlab-MEX files, from the source code that resides in the matlab subfolder of your extracted libsvm package.

Below, I will call the libsvm-3.14 (for example: C:\libsvm-3.14) extracted folder ROOT (so replace ROOT wilth C:\libsvm-3.14 below).

So, fire up Matlab and, then, at its command prompt, type:

cd ROOT
cd matlab
make

Now, in the ROOT/matlab folder, you should have obtained two MEX files (with the .mexw32 or .mexw64 extension). These are the files that you will use from now on. You can discard the rest, except those files (and, maybe, some other generated libraries).

According to the Makefile (that is ROOT/matlab/make.m), the MEX files are called svmtrain and svmpredic (+ the extension).

So, next step would be to create a subfolder called libsvm/ under your's Matlab/toolbox folder, copy the two MEX files therein and, then, add that libsvm/ folder to the Matlab Path (not the Path of your system, but of your Matlab installation).

Then, by typing:

svmtrain

and

svmpredict

you should have the help (usage) of these two functions.