The Three-door probl...
前一篇短文讲了噪音信道模型和贝叶斯定理的某种微妙关系,本篇旨在通过解答一个经典的三重门问题,一探贝叶斯定理在更广范围的推理任务中的角色。
1. The problem setting
三重门问题(山羊悖论,或Monty Hall问题)描述如下。
“三个门标记为1,2,3,随机选取一个门放置奖品。游戏开始: 首先,选手任选一个门,如1号。然后,知道奖品在哪个门后的主持人会打开另外两个门中的一个,使得打开的那个门不含有奖品,如3号。此时,选手有更换选择的机会,如放弃原先选择的1号门,改选2号门。问:选手改选对自己是否有利?”
2. The problem solving
用贝叶斯定理解决该问题如下。
- 把上述问题形式化如下。
H = 1 表示1号门后有奖品;H = 2 表示2号门后有奖品;H = 3 表示3号门后有奖品。
D = 2 表示主持人打开2号门; D = 3 表示主持人打开3号门。
- 由题意可得如下已知概率。
P(H=1) = 1/3; P(H=2) = 1/3; P(H=3) = 1/3;
P(D=2|H=1) = 1/2; P(D=3|H=1) = 1/2;
P(D=2|H=2) = 0; P(D=3|H=2) = 1;
P(D=2|H=3) = 1; P(D=3|H=3) = 0.
- 选手所关心的概率是:P(H=1|D=3), P(H=2|D=3)。由贝叶斯定理:
P(H=1|D=3) = P(H=1) * P(D=3|H=1) / P(D=3) = (1/3 * 1/2) / P(D=3);
P(H=2|D=3) = P(H=2) * P(D=3|H=2) / P(D=3) = ( 1/3 * 1 ) / P(D=3);
注1:P(H=3|D=3) = P(H=3) * P(D=3|H=3) / P(D=3) = (0 * 1/2) / P(D=3) = 0.
注2:归一化证据 (全概率) P(D=3) = 1/2.
所以:
P(H=1|D=3) = 1/3
P(H=2|D=3) = 2/3
P(H=2|D=3) / P(H=1|D=3) = 2 : 1
因此选手改选对自己是有利的。
3. 模拟实验
- 在线三重门游戏:http://stayorswitch.com/
- Wikipedia 和 RosettaCode 给出的模拟结果
可以看出,改选和不改选的几率约为 2:1,符合上述贝叶斯推理的结果。
说明:素材取自David MacKay信息论第三章练习题,练习题中还包含有该题的一些变体。
扩展阅读1:Ch. Randomness (1990–91), The Calculus of Friendship, Steven Strogatz, 2011. (中文译名:<心里有数的人生>)
1) 三种选择:
There are three possible ways the game could play out:
- You pick goat 1. Monty shows you goat 2. You switch. You win the car.
- You pick goat 2. Monty shows you goat 1. You switch. You win the car.
- You pick the car. Monty shows you a goat. You switch. You get the other goat.
So by switching, you win two out of three times.
2)极限情况:
To consider the limiting case of many doors, say a thousand of them.
- You pick door #1. Like every other door, it's a one-in-a-thousand long shot. Then Monty opens 998 doors with goats behind all of them, leaving only yours and one other, say door #723.
- ''Now,'' he asks, ''would you like to keep what's behind door #1, or switch to door #723?''
Can you see he's practically telling you where the car is? Switch to #723! Or do you really have so much faith in your guessing ability that you believe #1 is worth keeping?
3)要点:主持人事先知道奖品在哪里,他总是为你排除掉一些山羊,剩下奖品。
扩展阅读2:Ch. 11 Experimentation, Writing for Computer Science, Justine Zobel, Second Edition, 2004.
Intuition
A well-known example is the three-box problem. A contestant in a game is
told that one of X, Y, or Z contains a prize. The contestant chooses X but does
not open it. The host then opens Y and shows that it is empty. Should the contestant
change to Z or stay with X?
Intuition says that it doesn't matter, as the
probability of X containing the prize is 1/2. Careful analysis of the alternatives
shows that Z contains the prize with probability 2/3, but when this problem was
presented many mathematicians publicly argued that 1/2 was correct.
In a variation of this error, suppose that person P has tossed two coins.
Person Q asks if one of them is heads, and P says yes. Then the intuitive estimate
of the probability that the other coin is heads is 1/2, on the basis that
the status of one coin is independent of the other, but again this is wrong. The
correct response is 1/3. The reason is that there are four possible configurations:
heads-heads, heads-tails, tails-heads, and tails-tails. Only tails-tails is
eliminated by Q's question.
留下你的评论