Search code examples
matlablibsvm

Download LIBSVM for Matlab on OS X Yosemite version 10.10.2?


Im looking to figure out how to download libsvm for matlab, I hear it is much quicker than the support vector machine matlab functions already in place?


Solution

  • Please note, the reason I'm answering this is because the documentation is not detailed enough and I had trouble installing LibSVM on OS X on my first try. After much tinkering, this is the best procedure I have come up with so far.

    Yes, it is much quicker and more accurate for nonlinear kernels. Performance wasn't significantly difference from my experience for linear kernels. I'm running OS X v10.10.2 Yosemite as well.

    Here are the instructions to install LibSVM:

    1. Download the zip from their website and extract it if Safari hasn't already.
    2. Install Xcode so that LibSVM can compile MEX
    3. Restart/open Matlab. You need to open Matlab again for it to detect Xcode.
    4. Use "cd" command to navigate the working directory to "LIBSVM_FOLDER/libsvm-3.20/matlab/". If you type ls, you should see "make.m".
    5. Type "make" to run the "make.m" script.
    6. The .mexmaci64 and .mexw64 files for libsvmread/libsvmwrite/svmtrain/svmpredict will be created. svmtrain/svmpredict are your Matlab functions that you can call from your Matlab console to use libsvm.

    For more information, please visit http://www.csie.ntu.edu.tw/~cjlin/libsvm/

    Caveats/Notes

    • Use the help command to see the function's help text
    • You can rename these files to your liking to rename the function name
    • I renamed and created a wrapper functions around svmtrain/svmpredict called libsvmclassify/libsvmtrain to remain consistent with Matlab nomenclature and input format
    • Make sure to have these files in your working directory or "addpath" to them
    • Don't forget to cite their paper when you use LibSVM for research