比较模型之间的 AUC、对数损失和准确度分数

Comparing AUC, log loss and accuracy scores between models

我在 test set 上有以下评估指标,在 运行 6 个模型 binary classification problem 之后:

  accuracy logloss   AUC
1   19%      0.45   0.54
2   67%      0.62   0.67
3   66%      0.63   0.68
4   67%      0.62   0.66
5   63%      0.61   0.66
6   65%      0.68   0.42

我有以下问题:

非常简短,带有链接(部分内容已在别处讨论过)...

How can model 1 be the best in terms of logloss (the logloss is the closest to 0) since it performs the worst (in terms of accuracy). What does that mean ?

虽然损失是准确性的代表(反之亦然),但在这方面它并不是非常可靠的。仔细研究准确性和损失之间的具体机制在这里可能会有用;考虑以下 SO 线程(免责声明:答案是我的):

详细一点:

假设样本具有真实标签 y=1,来自 p=0.51 分类器的概率预测,以及 0.5 的决策阈值(即对于 p>0.5 我们分类为 1,否则为0),这个样本对准确率的贡献是1/n(即positive),而loss是

-log(p) = -log(0.51) = 0.6733446

现在,再次假设另一个样本为真 y=1,但现在的概率预测为 p=0.99;对准确性的贡献将是相同的,而现在的损失将是:

-log(p) = -log(0.99) = 0.01005034

因此,对于两个都被正确分类的样本(即它们以完全相同的数量对准确性做出积极贡献),我们在相应的损失方面存在相当大的差异...

虽然你在这里展示的内容看起来相当极端,但不难想象 y=1 的许多样本将在 p=0.49 周围的情况,因此给出 相对 低损失,但对准确性的贡献为零...

How come does model 6 have lower AUC score than e.g. model 5, when model 6 has better accuracy. What does that mean ?

这个比较简单。

至少根据我的经验,大多数 ML 从业者认为 AUC 分数衡量的东西与它实际所做的不同:常见(不幸的)用途就像任何其他 the-higher-the-better 指标,例如准确性,这自然会导致像您自己表达的那样的难题。

事实是,粗略地说,AUC 衡量的是二元分类器的性能在所有可能的决策阈值 上取平均值。因此,AUC 实际上并没有衡量特定部署模型的性能(包括所选的决策阈值),而是 family 模型在所有阈值上的平均性能(绝大多数您当然不会对其中的内容感兴趣,因为它们永远不会被使用。

出于这个原因,AUC 开始在文献中受到严厉批评(不要误读 - ROC 曲线 本身的分析非常有用且有用); Wikipedia entry 和其中提供的参考资料强烈推荐阅读:

Thus, the practical value of the AUC measure has been called into question, raising the possibility that the AUC may actually introduce more uncertainty into machine learning classification accuracy comparisons than resolution.

[...]

One recent explanation of the problem with ROC AUC is that reducing the ROC Curve to a single number ignores the fact that it is about the tradeoffs between the different systems or performance points plotted and not the performance of an individual system

强调我的 - 另见 On the dangers of AUC...

简单的建议:不要使用它

Is there a way to say which of these 6 models is the best ?

取决于“最佳”的确切定义;如果“最佳”意味着最适合我自己试图解决的业务问题(不是对 ML 从业者 的非理性定义),那么它是根据适用于您自己定义的问题的 business 指标表现更好的那个。这 永远不会 是 AUC,通常它也不是损失...