code:
from sklearn import svm X = [[0,0],[1,1]] Y = [0,1] clf = svm.SVC() clf.fit(X,Y) print("clf.predict([[2.0,2.0]])" % clf.predict([[2.0,2.0]])) #get support vectors print("support vectors, clf.support_vectors_ : " , clf.support_vectors_ ) #get indices of support vectors print("indices of supprt vectors, clf.support_ :" , clf.support_) #get number of support vectors for each class print("get number of support vectors for eache class " , clf.n_support_)
执行结果,如下图: