我正在尝试在 scikit 中训练 SVM。我正在遵循该示例并尝试将其调整为我的 3d 特征向量。
我尝试了页面中的示例http://scikit-learn.org/stable/modules/svm.html http://scikit-learn.org/stable/modules/svm.html它跑了过去。在修复错误时,我回到教程设置并发现了这一点:
X = [[0, 0], [1, 1],[2,2]]
y = [0, 1,1]
clf = svm.SVC()
clf.fit(X, y)
工作同时
X = [[0, 0,0], [1, 1,1],[2,2,2]]
y = [0, 1,1]
clf = svm.SVC()
clf.fit(X, y)
失败并显示:ValueError: X.shape[1] = 2 should be equal to 3, the number of features at training time
这里出了什么问题?这只是一个额外的维度......
谢谢,
埃尔