贝叶斯公式的理解 Introduction to Bayes Theorem

1. 问题引入
贝叶斯公式是一个用于计算条件概率的方法。尽管贝叶斯定律十分简单,但真正深层次理解并且可以在任何场景下使用还是需要进一步来学习。
In this tutorial, 我们将在多种实际场景下使用贝叶斯公式来进行理解。


2. 什么是贝叶斯公式?
条件概率是给定一个事件发生的情况下,另外一个事件发生的概率。条件概率可以通过联合概率来计算:
P ( A ∣ B ) = P ( A ; B ) P ( B ) . P(A|B) = \frac{P(A; B)}{P(B)}. P(AB)=P(B)P(A;B).
此外,还可以通过另外一个事件的条件概率来计算:
P ( A ∣ B ) = P ( B ∣ A ) × P ( A ) P ( B ) . P(A|B) = \frac{P(B|A) \times P(A)}{P(B)}. P(AB)=P(B)P(BA)×P(A).
这个公式也被称为贝叶斯公式,它提供了一种不使用联合概率来计算条件概率的方法。通常情况下,P(B)不可获得,但可以通过来计算:
P ( B ) = P ( B ∣ A ) × P ( A ) + P ( B ∣ n o t   A ) × P ( n o t   A ) . P(B) =P(B|A) \times P(A) + P(B| not \ A) \times P(not \ A). P(B)=P(BA)×P(A)+P(Bnot A)×P(not A).


3. 命名贝叶斯公式中的各项
P(A|B):后验概率;
P(A):先验概率;
P(B|A):似然概率;
P(B):证据。

贝叶斯公式可以被理解为:后验概率 = (似然概率 X 先验概率) / 证据;
举个例子:烟(smoke)和火焰(fire)事件,我们想要计算观测到smoke后,fire发生的概率 P(fire | smoke),给定的概率有 P(fire)火焰的先验概率、P(smoke | fire)发生火后出现烟的似然概率, P(smoke)证据概率。


3. Example 1
事件 B:年老的人(超过80岁)摔倒;
事件 A:年老的人死亡;
事件 A|B:摔倒后导致死亡;
先验概率 P(A) = 0.1;(年老的人死亡的概率)
证据 P(B) = 0.05;(年老的人摔倒的概率)
似然概率 P(B|A) = 0.07;(已经死去的人,发生摔倒的概率)

通过贝叶斯公式来计算年老的人摔倒后死亡的概率:
P ( A ∣ B ) = P ( B ∣ A ) × P ( A ) P ( B ) = 0.14 P(A|B) = \frac{P(B|A) \times P(A)}{P(B)} = 0.14 P(AB)=P(B)P(BA)×P(A)=0.14


4. Example 2
事件A:我们收到垃圾邮件;P(A) = 0.02;
事件B:系统检测为垃圾邮件;
事件B|A:当收到垃圾邮件后,系统能检测到;P(B|A) = 0.99;
事件B|not A:当收到正常邮件后,系统检测为垃圾邮件;P(B| not A) = 0.001;
现在我们需要计算:系统检测为垃圾邮件时,其是垃圾邮件的概率 P(A|B)
P ( A ∣ B ) = P ( B ∣ A ) × P ( A ) P ( B ) = 0.99 × 0.02 0.99 × 0.02 + 0.001 × 0.98 = 0.953 P(A|B) = \frac{P(B|A) \times P(A)}{P(B)} = \frac{0.99 \times 0.02}{0.99 \times 0.02 + 0.001 \times 0.98} = 0.953 P(AB)=P(B)P(BA)×P(A)=0.99×0.02+0.001×0.980.99×0.02=0.953


5. Example 3
事件A:说谎;P(A) = 0.02;
事件B | A:人说谎的时候,测谎仪预测为说谎;P(B|A) = 0.72;
事件not B | not A: 人说真话的时候,测谎仪预测为真话;P(not B | not A) = 0.97;
计算测谎仪预测为说谎(B)时,人说谎的概率(A):P(A|B)
P ( A ∣ B ) = P ( B ∣ A ) × P ( A ) P ( B ) = 0.72 × 0.02 0.97 × 0.02 + 0.03 × 0.98 = 0.329. P(A|B) = \frac{P(B|A) \times P(A)}{P(B)} = \frac{0.72 \times 0.02}{0.97 \times 0.02 + 0.03 \times 0.98} = 0.329. P(AB)=P(B)P(BA)×P(A)=0.97×0.02+0.03×0.980.72×0.02=0.329.

At its core, Bayes' Theorem is a simple probability and statistics formula that has revolutionized how we understand and deal with uncertainty. If life is seen as black and white, Bayes' Theorem helps us think about the gray areas. When new evidence comes our way, it helps us update our beliefs and create a new belief. Ready to dig in and visually explore Bayes' Theorem? Let’s go! Over 60 hand-drawn visuals are included throughout the book to help you work through each problem as you learn by example. The beautifully hand-drawn visual illustrations are specifically designed and formatted for the kindle. This book also includes sections not found in other books on Bayes' Rule. These include: A short tutorial on how to understand problem scenarios and find P(B), P(A), and P(B|A). - For many people, knowing how to approach scenarios and break them apart can be daunting. In this booklet, we provide a quick step-by-step reference on how to confidently understand scenarios. A few examples of how to think like a Bayesian in everyday life. Bayes' Rule might seem somewhat abstract, but it can be applied to many areas of life and help you make better decisions. Learn how Bayes can help you with critical thinking, problem-solving, and dealing with the gray areas of life. A concise history of Bayes' Rule. - Bayes' Theorem has a fascinating 200+ year history, and we have summed it up for you in this booklet. From its discovery in the 1700’s to its being used to break the German’s Enigma Code during World War 2. Fascinating real-life stories on how Bayes' formula is used everyday.From search and rescue to spam filtering and driverless cars, Bayes is used in many areas of modern day life. An expanded Bayes' Theorem definition, including notations, and proof section. - In this section we define core elementary bayesian statistics terms more concretely. A recommended readings sectionFrom The Theory That Would Not Die to Think Bayes: Bayesian Statistics in Pythoni> and many more, there are a number of fantastic resources we have collected for further reading.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值