The project I am currently working on makes use of the sklearn svm.SVC class where at one point in the code instantiate the following:
self.classifier = OneVsRestClassifier(SVC(kernel = 'linear', probability = True))
After fitting the classifier, I then try to inspect the support_vector_ or support_ attributes of the classifier. However, I get the following error:
'SVC' object has no attribute 'support_vectors_'
I tried changing the kernel to 'poly' or 'rbf', but this does not fix the error. Why is this happening? Shouldn't any linear SVM have something (i.e. 'None' at the least) for this attribute? I am using sklearn version 0.15.1 if that helps.
Thanks!
Assuming you obtained the error message by trying to evaluate
observe that
OneVsRestClassifier
clones your estimator as many times as there are classes and fits as many of them to your data. They can be found in theestimators_
variable of the ovr. TryThat will give you the support vectors for the first OVR problem.