OK. So I don't know that I can truly answer this question. If anyone who stumbles across this seems to know the answer, and would like to replace my pseudo-answer, then please leave a comment, and I will change my answer to a comment, and replace it with a better answer.
Ultimately I was just trying to arrive at the solution stated above in the original question. I have in fact reached a solution that works just fine:
Download and run pyvision included installer!
Open a terminal and paste the following line:
svn co https://pyvision.svn.sourceforge.net/svnroot/pyvision/trunk pyvision
Once you've got it type:
cd pyvision/R/libsvm/python/
python setup.py install
And now you'll be able to open a terminal and type:
python
>>> import svmc
>>>
Voila! No errors, and libsvm hotness (Version 2.84, which should work fine in most situations--Please feel free to correct me!)
Thank you, and good luck to all my Macintosh OS X people out there! Michaux
Answer from mkelley33 on Stack ExchangeFirst download and save svmutil.py file in the location where you are running your jupyter notebook. Then import svmutil functions using
from svmutil import *
You could be able to use its functionalities
svm_train() : train an SVM model
svm_predict() : predict testing data
svm_read_problem() : read the data from a LIBSVM-format file.
svm_load_model() : load a LIBSVM model.
svm_save_model() : save model to a file.
evaluations() : evaluate prediction results.
You'll need to install the library first. Here's a complete example:
https://colab.research.google.com/drive/1svYMGnV7HdeqXpN15T5ajxbLijLmBeSm
The key bits:
# Clone the git repo.
!git clone https://github.com/Netflix/vmaf.git
# Build the library.
%cd vmaf/
!make && make install
# Build Python-specific bits.
%cd /content/vmaf/libsvm/python/
!make
# Add the Python module to the path.
import sys
sys.path.append('/content/vmaf/libsvm/python')
# Switch back to the base directory. (This is a convenience
# and isn't required.)
%cd /content
Instead of going through libsvm in order to access it with Python (I installed libsvm through MacPorts, and import svmutil fails), you might want to install the popular scikit-learn package, which contains an optimized version of libsvm with Python bindings.
The install is very simple with MacPorts: sudo port install py27-scikit-learn (adapt py27 to whatever version of Python you use).
Seems like a old thread. Hope it helps someone else in the future.
I had the same problem. The solution is
- Run
makein libsvm-3.0 directory - Run
makein libsvm-3.0/python directory
If you did only at libsvm-3.0 folder you will face this issue. Do it at both the folders. Then it will work fine.
» pip install libsvm-official