Skip to content

Instantly share code, notes, and snippets.

@arseniyturin
Last active July 30, 2021 16:37
Show Gist options
  • Save arseniyturin/ee91b17a34e5d926fcff9b0870b76eb3 to your computer and use it in GitHub Desktop.
Save arseniyturin/ee91b17a34e5d926fcff9b0870b76eb3 to your computer and use it in GitHub Desktop.
Should you bring an umbrella if 3 of your friends said it will rain?
'''
Question: You're travelling to Seattle and you've asked 3 of your friends independently if it will rain,
3 of them said it will. Each friend has 2/3 chances of being right. Should you bring an umbrella?
Assume chance of rain is 25%
P(rain) * P(yes | rain)
P(rain | yes) = ------------------------
P(yes)
P(rain) = 0.25
P(yes | rain) = P(yes and rain) / P(rain) = 0.25 * (2/3)^3 / 0.25 = 8/27
P(yes) = P(rain) * P(yes | rain) + P(no rain) * P(yes | no rain) = 0.25 * 8/27 + 0.75 * 1/27
0.25 * 8/27
P(rain | yes) = ----------------------------- = 0.727
(0.25 * 8/27 + 0.75 * 1/27)
'''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment