I am using SGD svm from scikit learn. I find that unlike SVC who has support_ as a member of the model to store the index of the support vectors, SGDClassifier only gives me the weight of the decision boundary. Is there any way that I can identify support vectors within each class while using SGD support vector machine?
1 Answer
You may have some mis-understanding of SVM types. There is no SGD SVM. See this post.
Difference between the types of SVM
Stochastic gradient descent (SGD) is an algorithm to train the model. According to the documentation, SGD algorithm can be used to train many models. SVM is just one special case. More information about SGD, can be found here.
How could stochastic gradient descent save time comparing to standard gradient descent?
Therefore, SGD will not affect what is inside of SVM. If you are using SVC (C-Support Vector Classification) and use SGD for learning, you should still have everything about SVC. The $\alpha$ will tell you where are the "support vectors" as usual.
In python, it is possible they use some object oriented design that hide some fields if you are using SGD classifiers. But that should be a stack overflow question.
-
$\begingroup$ Thank you very much. In that case,I will try to have a look at the source code see whether I can extract the support vectors out. $\endgroup$ Commented Oct 31, 2016 at 16:04