Deep insight
correlation, causation
Sick
In hospital 40, died 4 10%
home 8000, died 20 0.25%
Chances of dying in hospital are 40 times larger than at home
hospital died
sick 36 4 11.1%
health 4 0 0%
At home
sick 40 20 50%
healthy 7960 20 0.251%
P(exactly one head)
–
P(first flip is only head)
= 4
def test(coins, flips): f=FlipPredictor(coins) quesses=[] for flip in flips: f.update(flip) quesses.append(f.Pheads()) return guesses print test([0.5,0.4,0.3],'HHTH')
from __future__ import division class FlipPredictor(object): def __init__(self,coins): self.coins=coins n=len(coins) self.probs=[1/n]*n def Pheads(self): def update(self,result):