机器学习SVM使用

版权声明:未经王小波同学允许不得转载本文内容,否则将视为侵权;博主qq:1419758909;反正也没人转载~ https://blog.csdn.net/qq_38900441/article/details/80015648
from sklearn import svm

x = [[1, 1], [2, 0], [2, 3]]
y = [0, 0, 1]  # 分类标记
clf = svm.SVC(kernel='linear')  # SVM模块,svc,线性核函数
clf.fit(x, y)

print(clf)

print(clf.support_vectors_)  # 支持向量点
#
print(clf.support_)  # 支持向量点的索引
#
print(clf.n_support_)  # 每个class有几个支持向量点

print (clf.predict([[2,3]]))

猜你喜欢

转载自blog.csdn.net/qq_38900441/article/details/80015648