'numpy.ndarray'对象没有属性'as_matrix'

时间:2019-06-27 10:38:25

标签: numpy

编译此代码时出现错误。请帮助

train_images = train_images.as_matrix()
train_labels = train_labels.as_matrix()

test_images = test_images.as_matrix()
test_labels = test_labels.as_matrix()

1 个答案:

答案 0 :(得分:0)

您可以尝试np.asmatrix(),因为您的数组似乎是numpy数组,它没有as_matrix()属性,例如

train_images = np.asmatrix(train_images)
train_labels = np.asmatrix(train_labels)

与测试集相同