Kavita Ganesan 09月25日
机器学习中的精确率和召回率
index_new5.html
../../../zaker_core/zaker_tpl_static/wap/tpl_guoji1.html

 

精确率和召回率是衡量机器学习模型性能的常用指标。精确率衡量正确预测为正例的比例,召回率衡量模型正确识别出所有实际正例的比例。以电子邮件垃圾邮件预测为例,通过比较模型预测与实际标签,可以评估模型的准确性。高精确率意味着模型预测的正例多为真阳性,但可能漏掉部分正例;高召回率则表示模型能捕捉到大部分正例,但可能将负例误判为正例。理想的模型需要在精确率和召回率之间取得平衡,以避免过度保守或过度泛化。

📊精确率衡量模型预测为正例的正确比例,即真阳性占所有预测为正例的比例。在垃圾邮件预测中,模型预测为 spam 的邮件中,实际为 spam 的邮件占比为精确率。例如,模型预测2封邮件为 spam,其中1封实际为 spam,则精确率为50%。

🔄召回率衡量模型正确识别出所有实际正例的比例,即真阳性占所有实际正例的比例。在垃圾邮件预测中,所有实际为 spam 的邮件中,被模型正确预测为 spam 的邮件占比为召回率。例如,实际有3封 spam 邮件,模型仅正确预测出1封,则召回率为33%。

🎯精确率和召回率需要权衡:高精确率意味着模型预测的正例多为真阳性,但可能漏掉部分正例;高召回率则表示模型能捕捉到大部分正例,但可能将负例误判为正例。理想的模型需要在两者之间取得平衡,以避免过度保守或过度泛化。

📈应用场景决定接受标准:精确率和召回率的可接受水平取决于具体应用。例如,在医疗诊断中,召回率可能比精确率更重要,因为漏诊的代价更高;而在垃圾邮件过滤中,精确率可能更重要,因为误判为垃圾邮件的合法邮件带来的不便相对较小。

Precision and recall are commonly used metrics to measure the performance of machine learning models or AI solutions in general. It helps understand how well models are making predictions.

Let’s use an email SPAM prediction example. Say you have a model that looks at an email and decides whether it’s SPAM or NOT SPAM. To see how well it’s doing, you want to compare it with human-generated labels, which we will call the actual labels.

To demonstrate this, the table below shows you some actual labels and the machine (model) predicted labels. Now we’ll assume that the spam prediction is positive, and the not spam prediction is negative.

Email IDActual LabelMachine Predicted Label
Email 1Spam (positive)Spam (positive & correct)
Email 2Spam (positive)Not Spam (negative & incorrect)
Email 3Not Spam (negative)Spam (positive & incorrect)
Email 4Spam (positive)Not Spam (negative & incorrect)
Email spam predictions with corresponding true predictions.

What is Precision in ML?

Given this, intuitively, precision measures the proportion of correct positive predictions.

How precision is computed

As you can see from the table above, out of the 2 spam (positive) machine predictions, only 1 is correct. So the precision is 0.5 or 50%.

What is Recall in ML?

Recall measures the proportion of actual positive labels correctly identified by the model.

How recall is computed

From the table above, notice that we have 3 actual labels that are positive, and out of that only one is correctly captured by the model. So the recall is 0.33 or 33%.

All in all, in the SPAM prediction example, precision is 50% and recall is 33%.

What Message Do Precision and Recall Convey?

What precision measures at a high level is correctness. What recall measures at a high level is coverage. For example, if precision is 98% it means that when the model says the prediction is positive, the prediction is likely accurate. A model can be overly conservative and only make limited positive predictions, resulting in high precision. In other words, it fails to make sufficient positive predictions. This is why you also need to consider recall—to ensure you’re capturing sufficient actual positives.

When it comes to recall, a high recall means that the model can capture most of the positive predictions. But if a model says everything is positive regardless of underlying reasoning, the recall will be artificially high and close to perfect. That’s why you need to balance between precision and recall. You want accurate predictions, but at the same time not at the cost of missing out on too many positive predictions (false negative predictions). Ideally, you want sufficiently high precision and recall.

Summary

In summary, precision measures the proportion of correct positive predictions, and recall measures the coverage of actual positive labels. For a model to be considered “good” both precision and recall must be at acceptable levels. In the end, what’s acceptable depends on the application.

Keep Learning & Succeed With AI

    Join my AI Integrated newsletterwhich clears the AI confusion and teaches you how to successfully integrate AI to achieve profitability and growth in your business.Read  The Business Case for AI to learn applications, strategies, and best practices to be successful with AI (select companies using the book: government agencies, automakers like Mercedes Benz, beverage makers, and e-commerce companies such as Flipkart).Work directly with me to improve AI understanding in your organization, accelerate AI strategy development and get meaningful outcomes from every AI initiative.

Recommended Reading:

Fish AI Reader

Fish AI Reader

AI辅助创作,多种专业模板,深度分析,高质量内容生成。从观点提取到深度思考,FishAI为您提供全方位的创作支持。新版本引入自定义参数,让您的创作更加个性化和精准。

FishAI

FishAI

鱼阅,AI 时代的下一个智能信息助手,助你摆脱信息焦虑

联系邮箱 441953276@qq.com

相关标签

机器学习 精确率 召回率 性能指标 垃圾邮件过滤
相关文章