ramko
ramko

Reputation: 173

Invoking Libsvm model in python

I have generated a libsvm model and i need to invoke them into my python codes. So that the user gives the raw input and then it converts into libsvm format and finally predicts the results stating the accuracy . Is it possible to do it.

Upvotes: 1

Views: 249

Answers (1)

lejlot
lejlot

Reputation: 66835

svmutil.py which is included in the libsvm official release contains the method for loading the trainged libsvm model from file:

svm_load_model(model_file_name)

So you can just run (after importing it from svmutil)

clf = svm_load_model( 'model.txt' )

Of course package includes the full python binding to the libsvm, so you can perform any kind of actions (training, testing, predicting etc.) with it.

Upvotes: 1

Related Questions