Lesson 5 - 贝叶斯规则

如题所述

第1个回答  2022-06-15

使用癌症案例

有一种特定的癌症 在人群中的发病率为 1%

这种癌症的一种化验,有 90% 的几率,在得了这种癌症的情况下呈阳性,这通常被叫做 敏感度(Sensitivity)

但有时候即便没有得癌症,化验也呈阳性,比如 另外有 90% 的几率,没有得癌症的情况下呈阴性,这通常被叫做 特异度(Specitivity)

那么对于以下问题:

在没有其他症状的情况下 你进行了化验,结果呈阳性
你认为的这种特定类型癌症的概率是多少?

要回答这个问题 我们先画个图

假设这些是所有人,其中刚好有 1% 得了癌症,99% 没得癌症

我们知道有一种化验,如果你得了癌症,可以有 90% 的几率正确诊断出来, 如果我们画出化验呈阳性的区域 (红色阴影部分)

但是 这并不是全部的真实情况,化验还有可能在没有癌症的,情况下呈阳性, 实际上 在我们的例子里,这占所有情况的 10%,因此 我们必须添加更多区域,就是这个大的区域的10%,这里化验结果可能在没有癌症的情况下,呈阳性( 蓝色阴影部分 ). 很显然 这些圆圈外的所有区域,对应没得癌症并且,化验呈阴性的情况

 
 
下面首先了解一些基本术语.

先验概率( Prior probability ) : 进行化验之前的概率

后验概率( posterior probability ) : 通过化验得到一些证据, 这样我们就得到了所谓的后验概率

贝叶斯法则( Bayesion rule ) 可以将化验中得到的一些证据, 纳入你的先验概率中,并得到后验概率

例如, 在癌症的例子中, 癌症的 先验概率(Prior probability) 为1%, 患癌症并且检测为阳性的概率为90%.

对于 后验概率(posterior probability) , 我们的问题是由阳性来推出得癌症得概率, 因此要包括两部分, 一部分是 得癌症呈现阳性得概率 , 另一部分是 没有得癌症呈现阳性得概率.

那么计算可得:

然后对两部分进行 归一化(Normalization) , 在这个例子中表示 测试结果为阳性 , 也就是上图中蓝色区域加红色区域组成得 椭圆部分

对于之前的先验概率其实严格讲为两个事件的 联合概率(Joint Probability) , 最后得到 化验结果为阳性时得癌症的后验概率 , 就必须用 测试为阳性得到癌症的概率0.009 除以 Normalizer = 0.108

我们刚刚说过 有一种情况

例如 当你收到 阳性化验结果 时 你要做的是:

现在 你计算出了期望的后验概率
这就是贝叶斯法则的算法

对应到之前画的示意图中可得下图

练习

示意图如下

提示,贝叶斯法则如下所示:

我们可以将贝叶斯法则中的 A 和B 替换掉,显示为:

现在,我们了解先验概率和条件概率后,可以改写为:

不过我们还不知道一件事!我们看见红色的概率是多少? 答案是 0.5。

全概率法则
机器人看到红色有以下两种情况。

由此得出答案:

The following questions will help you review what you learned in the Bayes' Rule lesson.

For questions 1-3, assume you already have the following knowledge:

You’re interested in finding out the probability of a car stopping if it sees a yellow traffic light.

习题 1/5
When a car is stopped at an intersection, data shows that 12% of the time the light is yellow. So if we know a car is stopped, there's a 12% chance the light is yellow. This is called a conditional probability.

Given P(S) and P(Y) above, how would you represent this conditional probability in notation?

习题 2/5
Using what you know from question 1, answer the following: if the traffic light is yellow, what is the chance that the car will stop?

And intuitively this value seems about right; a car should stop about half the time when faced with a yellow light.

习题 3/5
Knowing that a car stopping at an intersection and the presence of a yellow traffic light are related events, what are P(S) and P(Y) known as?

Prior knowledge for question 4:

On a four-lane highway, cars are either going fast or not fast. Faster cars should go in the leftmost lanes.

习题 4/5
Given the above information, if a car is going fast, what is the probability that it will be in the leftmost lane?

Bayes' rule is not only used to incorporate sensor data into an estimate; it’s also often used to incorporate test data into a medical diagnosis.

Prior knowledge for question 5:

习题 5/5
Given the above data, what is the probability that a person has cancer if they have a positive cancer-test result? (Note: answers are rounded to the nearest 4th decimal place).

相似回答