Skip to content
Programming Collective Intelligence
Python
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
.gitignore
README.md
advancefilter.py
akismettest.py
clusters.py
deliciousrec.py
docclass.py
dorm.py
feedfilter.py
generatefeedvector.py
gp.py
newsfeatures.py
nmf.py
nn.py
numpredict.py
optimization.py
recommendations.py
searchengine.py
socialnetwork.py
treepredict.py
zillow.py

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.