AttributeError:'LinearSVC' object has no attribute 'predict_proba'
According to sklearn documentation , the method 'predict_proba' is not defined for 'LinearSVC'
Workaround:
LinearSVC_classifier = SklearnClassifier(SVC(kernel='linear',probability=True))
Use SVC with linear kernel, with probability argument set to True. Just as explained in here .
Given your question, there is no mentioning about some outside-wrapper like NLTK (except for the tag), so it's hard to grasp what you really need!
Vivek Kumar's comment applies. LinearSVC has no support for probabilities, while SVC does.
Now some additional remarks:
- SVM-theory is not much about probabilities and the support for this comes from extra-approaches using cross-validation and an additional classifier
- see Platt scaling
- the core-solver of LinearSVC, liblinear has not inbuilt-support for this
- the approach of mdilip above is a valid workaround, but:
- SVC is based on libsvm and therefore slower (and maybe not ready for large-scale)
- alternative: build your own pipeline consisting of:
- LinearSVC
- sklearn's probability-calibration
It seems someone observed this problem before.