【问题标题】:confusion_matrix() takes 2 positional arguments but 3 were givenfusion_matrix() 接受 2 个位置参数,但给出了 3 个
【发布时间】:2022-01-17 15:39:20
【问题描述】:

enter image description here

从上图可以看出,这个问题让我很困惑。

【问题讨论】:

标签: scikit-learn confusion-matrix


【解决方案1】:

labels 不是位置参数,而是关键字参数。

因此,您应该按如下方式调用该函数:

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

【讨论】:

    猜你喜欢
    • 2019-09-21
    • 2019-07-19
    • 2021-02-02
    • 2020-02-07
    • 2017-03-14
    • 2014-09-07
    • 1970-01-01
    • 1970-01-01
    • 2022-12-12
    相关资源
    最近更新 更多