Spyder中的混淆矩阵输出

问题描述 投票:0回答:2

我正在为我的混淆矩阵运行以下代码

from sklearn.metrics import confusion_matrix
cm = confusion_matrix(y_test, y_pred)

并且在打印变量cm时得到以下输出

array([[18, 10],
       [ 7, 61]], dtype=int64)

这里的输出是什么意思?

我已阅读以下链接,但不理解Confusion Matrix and Class Statistics

EDIT:-我的数据集具有三个类别(标签低,中,高)

python scikit-learn confusion-matrix
2个回答
0
投票

这是对您所得到的解释。

对于任何NxN混淆矩阵,以下成立:

Actual:是真实标签

enter image description here


对于2x2的情况(简单的说明:] >>

enter image description here


也请阅读:https://scikit-learn.org/stable/modules/model_evaluation.html#confusion-matrix


0
投票

让我们仔细看一下结果:

© www.soinside.com 2019 - 2024. All rights reserved.