【发布时间】:2017-02-09 19:20:16
【问题描述】:
x_train:(153347,53)
x_test:(29039,52)
y:(153347,)
我正在使用 sklearn。为了交叉验证和重塑我的数据集,我做了:
x_train, x_test, y_train, y_test = cross_validation.train_test_split(
x, y, test_size=0.3)
x_train = np.pad(x, [(0,0)], mode='constant')
x_test = np.pad(x, [(0,0)], mode='constant')
y = np.pad(y, [(0,0)], mode='constant')
x_train = np.arange(8127391).reshape((-1,1))
c = x.T
np.all(x_train == c)
x_test = np.arange(1510028).reshape((-1,1))
c2 = x.T
np.all(x_test == c2)
y = np.arange(153347).reshape((-1,1))
c3 = x.T
np.all(y == c3)
我的错误信息是:ValueError: Found arrays with contrast numbers of samples: [2 153347]
我不确定在这种情况下我是否需要填充我的数据集并且重塑不起作用。关于如何解决此问题的任何想法?
【问题讨论】:
-
也许你应该提到你使用 sklearn 并描述更多你在做什么。否则,很可能会被忽略。
-
好的,谢谢你的提示。
-
这条消息来自哪里?看来您只是传递了一个转置的
y
标签: python numpy machine-learning scikit-learn cross-validation