ValueError:无法将输入数组从形状广播到sklearn score()

时间:2018-09-22 21:28:14

标签: python pandas numpy scikit-learn

我有一个形状为x_test的数据框((1672, 9376)),其对象是:

<1672x9376 sparse matrix of type '<class 'numpy.float64'>'
        with 14108 stored elements in Compressed Sparse Row format>

我正试图将这些数据传递到sklearn的score()方法中,以免像这样对标签数据进行标记:

classifier.score(x_test, y_test)

但是我收到此错误:

ValueError: could not broadcast input array from shape (0) into shape (1672)

我的y_test的形状为(1672,)

x_test内容

(Pdb) self.x_test[1,1]
0.0
(Pdb) self.x_test[1,2]
0.0
(Pdb) self.x_test[1,:]
<1x9376 sparse matrix of type '<class 'numpy.float64'>'
        with 1 stored elements in Compressed Sparse Row format>

0 个答案:

没有答案