Skip to content
This repository

Programming Collective Intelligence

tree: 8712354bde
README.md

pci

Programming Collective Intelligence

code and fixes

Using LIBSVM

prob = svm_problem([1, -1], [[1, 0, 1], [-1, 0, 1]])
#http://stackoverflow.com/questions/10343893/python-libsvm-typeerror-init-got-an-unexpected-keyword-argument-kernel
param = svm_parameter('-t 0 -c 1')
#http://stackoverflow.com/questions/4214868/an-example-using-python-bindings-for-svm-library-libsvm/4215056#4215056
from svmutil import *
m = svm_train(prob, param)
svm_model.predict = lambda self, x: svm_predict([0], [x], self)[0][0]
m.predict([1, 1, 1])
Something went wrong with that request. Please try again.