本文主要是介绍统计_三门问题:贝叶斯解答,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、三门问题
“假设你正在参加一个游戏节目,你被要求在三扇门中选择一扇:其中一扇后面有一辆车;其余两扇后面则是山羊。你选择了一道门,假设是一号门,然后知道门后面有什么的主持人,开启了另一扇后面有山羊的门,假设是三号门。他然后问你:“你想选择二号门吗?”转换你的选择对你来说是一种优势吗?”
二、问题简化
- 定义:
- Y为事件:门后面有车
X为事件:选择一个门
Z为事件:主持人打开一扇门
1号门:A;2号门:B; 3号门:C;
这时候能将问题描述为下述符号:
P(Y=A | X=A, Z = C) (即,你选择一号门,主持人打开三号门,那么车在一号门后面的概率)
是否大于
P(Y=B | X=A, Z =C) (即,你选择一号门,主持人打开三号门,那么车在二号门后面的概率)
三、问题解答
显然 P ( X ) = 1 / 3 P( X) = 1/3 P(X)=1/3 , P ( Y ) = 1 / 3 P(Y) = 1/3 P(Y)=1/3;
因为主持人知道门后面是什么 ,所以 P(Z = “三号门”) 的概率是依据剩下两个门后面是否有车所决定的。
P ( Z = C ∣ Y = A ) = 1 / 2 P(Z =C | Y= A) = 1/2 P(Z=C∣Y=A)=1/2
P ( Z = C ∣ Y = B ) = 1 P(Z = C | Y=B) = 1 P(Z=C∣Y=B)=1
P ( Z = C ∣ Y = C ) = 0 P(Z =C | Y= C) = 0 P(Z=C∣Y=C)=0
P ( Z = C ) = ( 1 / 2 + 1 + 0 ) / 3 = 1 / 2 P(Z = C) = (1/2 + 1 + 0)/3 = 1/2 P(Z=C)=(1/2+1+0)/3=1/2
- 贝叶斯公式转化
P ( Y = A ∣ X = A , Z = C ) = P ( X = A , Z = C ∣ Y = A ) P ( Y = A ) P ( X = A , Z = C ) P(Y=A | X=A, Z = C) = \frac{P(X=A, Z = C|Y=A )P(Y=A)}{P(X=A,Z=C)} P(Y=A∣X=A,Z=C)=P(X=A,Z=C)P(X=A,Z=C∣Y=A)P(Y=A)
因为:
P ( X = A , Z = C ∣ Y = A ) = P ( X = A ∣ Y = A ) ∗ P ( Z = C ∣ Y = A ) = 1 / 3 ∗ 1 / 2 = 1 / 6 P(X=A, Z = C|Y=A )=P(X=A|Y=A)*P(Z=C|Y=A)=1/3*1/2=1/6 P(X=A,Z=C∣Y=A)=P(X=A∣Y=A)∗P(Z=C∣Y=A)=1/3∗1/2=1/6
P ( X = A , Z = C ) = P ( X = A ) ∗ P ( Z = C ) = 1 / 3 ∗ 1 / 2 = 1 / 6 P(X=A,Z=C)=P(X=A)*P(Z=C)=1/3*1/2=1/6 P(X=A,Z=C)=P(X=A)∗P(Z=C)=1/3∗1/2=1/6
所以:
P ( Y = A ∣ X = A , Z = C ) = 1 / 6 ∗ 1 / 3 1 / 6 = 1 / 3 P(Y=A | X=A, Z = C) = \frac{1/6*1/3}{1/6}=1/3 P(Y=A∣X=A,Z=C)=1/61/6∗1/3=1/3
- 贝叶斯公式转化
P ( Y = B ∣ X = A , Z = C ) = P ( X = A , Z = C ∣ Y = B ) P ( Y = B ) P ( X = A , Z = C ) P(Y=B | X=A, Z = C) = \frac{P(X=A, Z = C|Y=B )P(Y=B)}{P(X=A,Z=C)} P(Y=B∣X=A,Z=C)=P(X=A,Z=C)P(X=A,Z=C∣Y=B)P(Y=B)
因为:
P ( X = A , Z = C ∣ Y = B ) = P ( X = A ∣ Y = B ) ∗ P ( Z = C ∣ Y = B ) = 1 / 3 ∗ 1 = 1 / 3 P(X=A, Z = C|Y=B )=P(X=A|Y=B)*P(Z=C|Y=B)=1/3*1=1/3 P(X=A,Z=C∣Y=B)=P(X=A∣Y=B)∗P(Z=C∣Y=B)=1/3∗1=1/3
P ( X = A , Z = C ) = P ( X = A ) ∗ P ( Z = C ) = 1 / 3 ∗ 1 / 2 = 1 / 6 P(X=A,Z=C)=P(X=A)*P(Z=C)=1/3*1/2=1/6 P(X=A,Z=C)=P(X=A)∗P(Z=C)=1/3∗1/2=1/6
所以:
P ( Y = B ∣ X = A , Z = C ) = 1 / 3 ∗ 1 / 3 1 / 6 = 2 / 3 P(Y=B | X=A, Z = C) = \frac{1/3*1/3}{1/6}=2/3 P(Y=B∣X=A,Z=C)=1/61/3∗1/3=2/3
结论
选择换门
因为:
P(Y=B | X=A, Z = C)=2/3 > P(Y=A | X=A, Z = C)=1/3
所以:
你选择一号门,主持人打开三号门,那么车在二号门后面的概率
这篇关于统计_三门问题:贝叶斯解答的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!