svm使用
from sklearn import svm
X = [[0, 0], [1, 1]]
y = [0, 1]
clf = svm.SVC()
clf.fit(X, y)
clf.predict([[2., 2.]])
模型默认参数
SVC(C=1.0, cache_size=200, class_weight=None, coef0=0.0,
decision_function_shape=’ovr’, degree=3, gamma=’auto’, kernel=’rbf’,
max_iter=-1, probability=False, random_state=None, shrinking=True,
tol=0.001, verbose=False)
获取支持向量点
clf.support_vectors_ # get support vectors 获取支持向量点
clf.support_ # get indices of support vectors 获取支持向量点的索引位置
clf.n_support_ # get number of support vectors for each class 获取所在分类的向量点个数