How to use the liblinearutil package to train and predict test file in python?

1.6k views Asked by At

Can anyone give any insight about the liblinearutil package in python? I want to train and test files. I did read the documentation but don't quite understand. I'm doing it this way:

from liblinearutil import *
def testing_func(train_file, test_file)
    prob, param = svm_read_problem(train_file)
    m = liblinear.train(prob, param)
    print "m"
    print m
    p_labels, p_acc, p_vals = liblinear.predict(y,x, m, '-b 1')
    print (p_labels, p_acc, p_vals)

But, I'm getting "No module named liblinearutil error"! Could somebody please explain!!

1

There are 1 answers

6
Ludovic Viaud On

this error tell you that liblinearutil is not installed ;) it's not available in pipy so you need to build from source for the good interpret (care if you have different python version installed)