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])) 會有錯誤??