机器学习 二分类分类阈值_分类指标和阈值介绍

机器学习 二分类分类阈值

分类评估 (Classification Evaluation)

The metric we use to evaluate our classifier depends on the nature of the problem we want to solve and the potential consequences of prediction error. Let’s examine a very common example of cancer diagnosis (ie. classified as having cancer or not having cancer). We want our model to predict as many actual/true cancer diagnoses as possible but we also know that it is statistically impossible to correctly identify all true cancer diagnoses. Our model will eventually classify/predict someone to have cancer when they actually don’t have cancer (false positive) and predict someone not to have cancer when they actually have cancer (false negative). The question we have to ask ourselves is “What is worse? Predicting someone to have cancer when they actually don’t or predicting someone not to have cancer when they do?”. The answer in this example is obvious as the consequences of telling someone they don’t have cancer when they do far outweigh the former. Let’s keep this example in mind but let’s review the commonly used classification performance metrics.

我们用来评估分类器的指标取决于我们要解决的问题的性质以及预测误差的潜在后果。 让我们检查一个非常常见的癌症诊断示例(即,分类为患有癌症或未患有癌症)。 我们希望我们的模型能够预测尽可能多的实际/真实癌症诊断,但我们也知道,从统计上讲不可能正确识别所有真实的癌症诊断。 我们的模型最终将分类/预测某人实际上没有癌症时(假阳性)患有癌症,并预测某人实际上没有癌症时(假阴性)患有癌症。 我们必须问自己的问题是:“更糟的是什么? 预测某人实际上没有癌症,还是预测某人没有癌症?”。 这个例子的答案是显而易见的,因为告诉某人没有癌症的后果要远远超过前者。 让我们牢记这个示例,但让我们回顾一下常用的分类性能指标。

分类效果指标 (Classification Performance Metrics)

混淆矩阵 (Confusion Matrix)

Image for post

A confusion matrix summarizes are the model’s predictions. It gives us the number of correct predictions (True Positives and True Negatives) and the number of incorrect predictions (False Positives and False Negatives). In our cancer example, if our model predicted someone to have cancer and the person has cancer that’s a true positive. When our model predicted someone not to have cancer and that person does not have cancer that’s a true negative. When our model predicted someone to have cancer but that person does not have cancer that’s a false positive (ie. the model falsely predicted a positive cancer diagnosis). Finally, when our model predicted someone not to have cancer but they do that’s a false negative (ie. the model falsely predicted a negative cancer diagnosis).

混淆矩阵总结的是模型的预测。 它为我们提供了正确预测的数量(真肯定和否定)和不正确预测的数量(假肯定和否定)。 在我们的癌症示例中,如果我们的模型预测某人患有癌症并且该人患有癌症,那将是真正的阳性。 当我们的模型预测某人没有癌症,而该人没有癌症时,这是真正的负面结果。 当我们的模型预测某人患有癌症,但该人没有癌症时,即为假阳性(即该模型错误地预测为阳性癌症诊断)。 最终,当我们的模型预测某人没有癌症,但是他们这样做时,那就是假阴性(即模型错误地预测出癌症诊断为阴性)。

Much of the remaining performance metrics are derived from the confusion matrix therefore, it is imperative you have a good understand.

其余大部分性能指标均来自混淆矩阵,因此,您必须有一个很好的了解。

准确性 (Accuracy)

In simplest terms, accuracy details how often our model is correct. In other words, is the number of correct predictions (TP, TF) divided by the total number of predictions. Accuracy is typically the first metric but it can be very misleading if not considered carefully. For example, let’s consider an imbalanced dataset that was used to train our model. We have 1000 non-cancer diagnoses and 10 cancer diagnoses. A model was able to correctly predict 900 of the non-cancer diagnoses and 1 of the cancer diagnoses would have an accuracy of 0.89% ((900+1)/1010=0.89).

用最简单的术语来说,准确性详细说明了我们的模型正确的频率。 换句话说,是正确预测(TP,TF)的数量除以预测的总数。 精度通常是第一个度量标准,但是如果不仔细考虑的话,可能会产生很大的误导。 例如,让我们考虑用于训练模型的不平衡数据集。 我们有1000个非癌症诊断和10个癌症诊断。 一个模型能够正确预测900项非癌症诊断,其中1项癌症诊断的准确性为0.89%((900 + 1)/1010=0.89)。

(TP+TN)/(TP+FP+FN+TN)

(TP + TN)/(TP + FP + FN + TN)

  • 19
    点赞
  • 96
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值