3
我正在尝试此代码片段。我使用scikits.learn 0.8.1Python scikits - 缓冲区的维数错误(预计1,得到2)
from scikits.learn import linear_model
import numpy as np
num_rows = 10000
X = np.zeros([num_rows,2])
y = np.zeros([num_rows,1])
# assume here I have filled in X and y appropriately with 0s and 1s from the dataset
clf = linear_model.LogisticRegression()
clf.fit(X, y)
我得到这个 - >
/usr/local/lib/python2.6/dist-packages/scikits/learn/svm/liblinear.so in scikits.learn.svm.liblinear.train_wrap (scikits/learn/svm/liblinear.c:992)()
ValueError: Buffer has wrong number of dimensions (expected 1, got 2)
什么在这里错了吗?
这是numpy的一般性错误时,禁止参数是一个数组。 – smci