Rak*_*sha 3 python compiler-errors confusion-matrix
我究竟做错了什么?我将两个变量都设置为列表。也尝试过np.array。
y = list(y_test.values)
yhat = list(predictions)
print(y)
print(yhat)
confusion_matrix = pd.DataFrame(confusion_matrix(y, yhat), columns=["Predicted False", "Predicted True"], index=["Actual False", "Actual True"])
display(confusion_matrix)
Run Code Online (Sandbox Code Playgroud)
出去:
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ..., 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ..., 0]
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-159-e1640f0e3b13> in <module>()
45 print(yhat)
46
---> 47 confusion_matrix = pd.DataFrame(confusion_matrix(y, yhat), columns=["Predicted False", "Predicted True"], index=["Actual False", "Actual True"])
48 display(confusion_matrix)
49
TypeError: 'DataFrame' object is not callable
Run Code Online (Sandbox Code Playgroud)
不知道这里发生了什么......