In case you are wondering how to use the awesome LIBSVM package with the awesome PyCharm IDE, here is a brief guide:

LIBSVM documentation  mention you need to

  • Download  libsvm(version 3.2 at the time of this writing)
  • Extract the zip to a folder. By default, this libsvm-3.20
  • Go to your command prompt, within the extracted directory, libsvm-3.20/, type “make”. This will create a file called libsvm.so.2. If this doesn’t work, google how to enable make command on Mac OS.
  • go to libsvm-3.20/python directory, type make. This will create 2 files: svm.py and svmutil.py

Now, within PyCharm, say that you have a folder called Project/code/ where your code is stored at this level. Copy svm.py and svmutil.py mentioned above to your Project/code/ directory and Copy libsvm.so.2 file to your Project/ directory.

From Project/code/somefile.py python file you can import the svm library with

from svmutil import *

That’s it. You should be all set.