You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For some reason underlying method predict_proba from sklearn package is not implemented for some of classifiers (LinearSVC, SGD with loss="hinge") and for some of them it returns result in kind of unexpected format:
Traceback (most recent call last):
File "classify.py", line 42, in <module>
neg_prob = classifier.prob_classify(feats).prob("neg")
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/nltk/classify/api.py", line 65, in prob_classify
return self.batch_prob_classify([featureset])[0]
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/nltk/classify/scikitlearn.py", line 74, in batch_prob_classify
return [self._make_probdist(y_proba[i]) for i in xrange(len(y_proba))]
File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/nltk/classify/scikitlearn.py", line 135, in _make_probdist
for i, p in enumerate(y_proba)))
TypeError: 'numpy.float64' object is not iterable
Also, to enable predict_proba for SVC/NuSVC you need to pass probability=True to the constructor.
The text was updated successfully, but these errors were encountered:
For some reason underlying method predict_proba from sklearn package is not implemented for some of classifiers (LinearSVC, SGD with loss="hinge") and for some of them it returns result in kind of unexpected format:
Also, to enable predict_proba for SVC/NuSVC you need to pass probability=True to the constructor.
The text was updated successfully, but these errors were encountered: