如何解决valueerror:应该是2d数组,而不是1d数组

ux6nzvsh  于 2021-07-14  发布在  Java
关注(0)|答案(0)|浏览(192)

我已经在sk上使用了度量,学习如何将度量精度与此模型进行比较:


# Model Accuracy, how often is the classifier correct?

a = y_test
b = df_train['Interest_Rate']
k = a.reshape(1, -1)
y = b.reshape(1, -1)
print("Accuracy:",metrics.accuracy_score(k, y))

但当我运行它时,为什么它会变成错误

raise ValueError(
ValueError: Expected 2D array, got 1D array instead:
array=[1 3 3 ... 1 3 2].
Reshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题