两个人比一个人好吗?
Are two heads better than one?

原始链接: https://eieio.games/blog/two-heads-arent-better-than-one/

这探讨了一个反直觉的概率问题,涉及不可靠的信息来源。你试图通过朋友爱丽丝和鲍勃来猜测硬币翻转的结果(正面或反面),他们都 20% 的时间说谎。令人惊讶的是,增加鲍勃的意见并不能提高仅信任爱丽丝所达到的 80% 的准确率。 原因在于,虽然鲍勃有时会同意爱丽丝,从而增强信心,但他也会引入分歧。当他们意见不一致时,你无法获得任何新信息,实际上是在随机猜测。他们意见一致带来的收益,完全被意见分歧带来的不确定性所抵消。 如果朋友数量为奇数(比如增加查理),那么增加朋友可以提高准确率,因为多数票可以打破僵局。然而,如果增加偶数的朋友(比如大卫),则再次无法提高准确率,重复了收益和损失相互抵消的模式。这种现象类似于政治科学中的康多塞陪审团定理,强调只有当每个选民有超过 50% 的可能性是正确的时,增加选民才能提高决策的准确性。作者在模拟一个不同的问题时发现了这个结果,并对这个意想不到的结果感到高兴。

## 两头并非总是更好:一个概率难题 这次Hacker News的讨论围绕一个概率难题:你试图猜硬币翻转的结果(正面或反面),可以向两位朋友爱丽丝和鲍勃寻求帮助。然而,他们每个人说真话的概率只有80%。令人惊讶的是,增加鲍勃并不能提高你的胜算,仍然只有80%的概率猜对。 核心问题在于,当爱丽丝和鲍勃意见不一致时,你无法获得任何信息。当他们意见一致时,虽然更可能正确,但你仍然本质上依赖于其中一个人的可信度。如果人数是偶数,增加更多朋友也无济于事,因为平局无法提供新的见解。 对话延伸到相关的概念,如纠错、群智以及历史上的导航技术(为什么水手更喜欢一个或三个计时器)。参与者探讨了不同诚实程度的情景,并讨论了提供信息者之间的*关系*如何比仅仅独立观察更有价值。最终,这个难题强调了仅仅增加更多数据点并不总是意味着提高准确性。
相关文章

原文

You’re playing a game with your lying friends Alice and Bob.

Bob flips a coin and shows it to Alice. Alice tells you what she saw - but she lies 20% of the time. Then you take your best guess on whether the coin is heads or tails.

Your best strategy is to trust whatever Alice says. You’re right 80% of the time.

Now Bob joins in. He makes up his mind independent of Alice, and he also lies 20% of the time 1.

1

Your friends are all liars!

You were right 80% of the time by trusting Alice.

How much better can you do with Bob’s help?

Here’s some empty space for you to think

I’m going to give you the answer below. So here’s some empty space for you to think in case you want to do the math yourself.

Alright, let’s do some math

The answer is 0% - you don’t do any better! You’re still exactly 80% to get the right answer.

To establish this, let’s write a simple simulation. We’ll flip a coin a million times, ask our friends what they saw, and observe the results.

For our strategy, we’ll look at a fact pattern (like “Alice says heads”), figure out what’s most likely (“the coin is heads”), and say “we guess the coin flip correctly whenever the most likely outcome occurs for this fact pattern” 2.

2

“Guess the most likely outcome” is optimal here, but it is very much not optimal if this game was adversarial. It’s important that Alice and Bob aren’t trying to trick us and that they’re deciding independently.

Here’s the code for that simulation. We’ll start with the easy case (just Alice):

The simulation code


from random import random
from collections import defaultdict

table = defaultdict(lambda: [0, 0])
LYING_PROB = 0.2
LYING_FRIENDS = ["Alice"]
ITERATIONS = 1_000_000

for _ in range(ITERATIONS):
    is_heads = random() > 0.5
    keys = []
    for lying_friend in LYING_FRIENDS:
        lied = random() < LYING_PROB
        answer = None
        if is_heads: answer = "T" if lied else "H"
        else: answer = "H" if lied else "T"
        keys.append(f"{lying_friend[0]}:{answer}")

    key = ", ".join(keys)

    table_idx = 0 if is_heads else 1
    table[key][table_idx] += 1

total_times_we_are_right = 0
for key, (times_heads, times_tails) in table.items():
    total = times_heads + times_tails
    heads_chance = 100 * round(times_heads / total, 2)
    tails_chance = 100 * round(times_tails / total, 2)
    pattern_chance = 100 * round(total / ITERATIONS, 2)

    print(f"{key} - chances -  H {heads_chance:4}% | T {tails_chance:4}% | occurs {pattern_chance}% of the time")

    
    
    total_times_we_are_right += max(times_heads, times_tails)

accuracy = round(total_times_we_are_right / ITERATIONS, 2)
print(f"\nOur accuracy: {100*accuracy}%")

This gives us:

% python heads.py
A:T - chances -  H 20.0% | T 80.0% | occurs 50.0% of the time
A:H - chances -  H 80.0% | T 20.0% | occurs 50.0% of the time

Our accuracy: 80.0%

Now let’s add Bob to the simulation. We see something like this:

% python heads.py
A:T, B:T - chances -  H  6.0% | T 94.0% | occurs 34.0% of the time
A:H, B:T - chances -  H 50.0% | T 50.0% | occurs 16.0% of the time
A:H, B:H - chances -  H 94.0% | T  6.0% | occurs 34.0% of the time
A:T, B:H - chances -  H 50.0% | T 50.0% | occurs 16.0% of the time

Our accuracy: 80.0%

That’s weird! But perhaps this gives you an intuition for what’s happening. By introducing a second player, we introduce the possibility of a tie.

A decent amount of the time, Alice and Bob agree. Most (~94%) of the time when that happens, they’re telling the truth. Occasionally they’re both lying, but that’s pretty unlikely.

But a meaningful portion of the time (32%) Alice says heads and Bob says tails, or vice versa. And in that case we don’t know anything at all! Alice and Bob are equally trustworthy and they disagreed - we’d be better off if we’d just gone and asked Alice 3!

3

I am deeply curious whether anyone else was read the book “Go Ask Alice” by their middle school science teacher in order to scare them straight or whether that was specific to my middle school experience.

Let’s prove it

Now that we’ve simulated this result, let’s walk through each case assuming that the coin landed on heads.

- both tell the truth
Alice: Heads (80%), Bob: Heads (80%)
happens 80% * 80% = 64% of the time
we always guess correctly in this case

- both lie
Alice: Tails (20%), Bob: Tails (20%)
happens 20% * 20% = 4% of the time
we never guess correctly in this case

- alice tells the truth, bob lies
Alice: Heads (80%), Bob: Tails (20%)
happens 80% * 20% = 16% of the time
we guess at random in this case; we're right 50% of the time

- alice lies, bob tells the truth
Alice: Tails (20%), Bob: Heads (80%)
happens 20% * 80% = 16% of the time
we guess at random in this case; we're right 50% of the time

Our total chance to guess correctly is:
64% + 16% / 2 + 16% / 2 = 64% + 8% + 8% = 80%

There’s something beautiful here. Our total chance to guess remains at 80% because our additional chance to guess correctly when Alice and Bob agree is perfectly offset by the chance that Alice and Bob disagree!

Meet Charlie (and David)

If our friend Charlie - who also lies 20% of the time - joins the fun, our odds improve substantially. If Bob and Alice disagree, Charlie can act as a tiebreaker.

% python heads.py
A:H, B:H, C:H - chances -  H 98.0% | T  2.0% | occurs 26.0% of the time
A:T, B:T, C:T - chances -  H  2.0% | T 98.0% | occurs 26.0% of the time
A:T, B:H, C:H - chances -  H 80.0% | T 20.0% | occurs 8.0% of the time
A:H, B:T, C:T - chances -  H 20.0% | T 80.0% | occurs 8.0% of the time
A:H, B:H, C:T - chances -  H 80.0% | T 20.0% | occurs 8.0% of the time
A:H, B:T, C:H - chances -  H 80.0% | T 20.0% | occurs 8.0% of the time
A:T, B:T, C:H - chances -  H 20.0% | T 80.0% | occurs 8.0% of the time
A:T, B:H, C:T - chances -  H 20.0% | T 80.0% | occurs 8.0% of the time

Our accuracy: 90.0%

But if David joins, the pattern repeats. David introduces the possibility of a 2-2 split, and our odds don’t improve at all!

% python heads.py
A:T, B:T, C:T, D:T - chances -  H  0.0% | T 100.0% | occurs 21.0% of the time
A:T, B:H, C:H, D:H - chances -  H 94.0% | T  6.0% | occurs 5.0% of the time
A:T, B:H, C:T, D:T - chances -  H  6.0% | T 94.0% | occurs 5.0% of the time
A:H, B:H, C:H, D:H - chances -  H 100.0% | T  0.0% | occurs 21.0% of the time
A:H, B:T, C:H, D:T - chances -  H 50.0% | T 50.0% | occurs 3.0% of the time
A:T, B:T, C:H, D:H - chances -  H 50.0% | T 50.0% | occurs 3.0% of the time
A:H, B:T, C:H, D:H - chances -  H 94.0% | T  6.0% | occurs 5.0% of the time
A:T, B:T, C:T, D:H - chances -  H  6.0% | T 94.0% | occurs 5.0% of the time
A:H, B:T, C:T, D:T - chances -  H  6.0% | T 94.0% | occurs 5.0% of the time
A:H, B:H, C:H, D:T - chances -  H 94.0% | T  6.0% | occurs 5.0% of the time
A:H, B:H, C:T, D:T - chances -  H 50.0% | T 50.0% | occurs 3.0% of the time
A:T, B:T, C:H, D:T - chances -  H  6.0% | T 94.0% | occurs 5.0% of the time
A:H, B:H, C:T, D:H - chances -  H 94.0% | T  6.0% | occurs 5.0% of the time
A:T, B:H, C:T, D:H - chances -  H 50.0% | T 50.0% | occurs 3.0% of the time
A:H, B:T, C:T, D:H - chances -  H 50.0% | T 50.0% | occurs 3.0% of the time
A:T, B:H, C:H, D:T - chances -  H 50.0% | T 50.0% | occurs 3.0% of the time

Our accuracy: 90.0%

And this continues, on and on, forever (as long as we have enough friends). If our number N of friends is odd, our chances of guessing correctly don’t improve when we move to N+1 friends.

Is there a name for this?

As far as I can tell, there’s no name for this weird little phenomenon. But it does appear, implicitly, in voting literature.

Condorcet’s jury theorem is a famous theorem in political science. It states:

  • If you have a group of voters of size N
  • …and they all vote, independently, on an issue with a correct answer
  • …and each voter votes the “right” way with probability P
  • …and we make whatever decision the majority of the voters vote for
  • …then if P > 50%, the chance that we make the right decision approaches 100% as we add more voters

Sounds a fair bit like our coin flipping problem. Here’s a simplifying assumption that Wikipedia makes when proving the theorem:

Hah! The proof explicitly recognizes (and dodges) the even-voter case precisely because that voter doesn’t add any information.

Why did I write this?

I stumbled upon this result while writing a simulation for a more complex problem. I was so surprised at the simulation results that I assumed that I had a bug in my code. And when I walked through the math by hand I was absolutely delighted.

I suspect some of the surprise for me was because I typically encounter problems like these in the context of betting, not voting. If we’re betting on coin flips, we’re certainly excited to bet more if Alice and Bob agree than if we’re just listening to Alice.

But voting is a different beast; our outcome is binary. There’s no way to harvest the additional EV from the increased confidence Bob sometimes gives us.

Anyway. I hope this delights you like it did me.

联系我们 contact @ memedata.com