from sklearn import svm
x = [[2,0,1],[1,1,2],[2,3,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,0,3])) #预测
小弟执行上列code 出现下列error
ValueError: Expected 2D array, got 1D array instead:
array=[2. 0. 3.].
Reshape your data either using array.reshape(-1, 1) if your data has a single
feature or array.reshape(1, -1) if it contains a single sample.
不能理解为什么print(clf.predict([2,0,3])) 会有错误??