gongwanyi
gongwanyi

Reputation: 35

confusion_matrix() takes 2 positional arguments but 3 were given

enter image description here

As can be seen from above picture,this problem makes me very confused.

Upvotes: 2

Views: 6270

Answers (1)

Antoine Dubuis
Antoine Dubuis

Reputation: 5304

labels is not a positional argument but a keyword argument.

Therefore, you should call the function as follow:

from sklearn.metrics import confusion_matrix
confusion_matrix(y_true, y_pred, labels=classes)

Upvotes: 1

Related Questions