I am working with the nice Python scikits.learn package to train some classifiers for part-based face recognition with the Histogram of Oriented Gradient feature. I've successfully trained a linear SVM to recognize a particular face part, but I am having strange issues with the predict_proba()
function.
I use the following training code:
import numpy as np
from scikits.learn import svm
# Do some stuff to prepare DATA matrix of feature vector samples
# And LABELS vector of 1's and 0's for positive and negative samples.
clf = svm.SVC(kernel='linear',probability=True)
clf.fit(DATA, LABELS)
But then when I run predict_proba([test_vector])
, I only ever see [[ 0.5 0.5 ]]
as the output, i.e. the uniform probability between my two binary classes.
Oddly, though, when I just use the predict()
function, it performs fairly well and certainly cannot be just trivially assigning everything uniform probabilities. On a test image, I get much more dense '1' classifications around the correct face part, and then some expected noisy '1' classifications elsewhere around the scene, but predominantly all '0' classifications, as expected.
What could be causing this malfunction with predict_proba()
?