def test_calculate_incorrect(): assert calculate_incorrect(guess=0, slip=0, learned=0.5) == 0.5 assert calculate_incorrect(guess=1, slip=1, learned=0.5) == 0.5 assert calculate_incorrect(guess=0, slip=1, learned=0.5) == 1 assert calculate_incorrect(guess=1, slip=0, learned=0.5) == 0 assert calculate_incorrect(guess=0.25, slip=0.05, learned=0.9) == 0.12 assert calculate_incorrect(guess=0.25, slip=0.05, learned=0.5) == 0.4 assert calculate_incorrect(guess=0.25, slip=0.05, learned=0.1) == 0.68
def likelihood(self, data, hypothesis): """ Given new data and one of the guess hypotheses, update the probability of that hypothesis. """ score, learned, slip = \ data['score'], data['learned'], data['slip'] return (score * calculate_correct(hypothesis, slip, learned) + (1 - score) * calculate_incorrect(hypothesis, slip, learned))
def get_slip_pmf_likelihood(data, hypothesis): """ Given new data and one of the slip hypotheses, update the probability of that hypothesis. """ score, learned, guess = \ data['score'], data['learned'], data['guess'] return (score * calculate_correct(guess, hypothesis, learned) + (1 - score) * calculate_incorrect(guess, hypothesis, learned))
def likelihood(self, data, hypothesis): """ Given new data and one of the slip hypotheses, update the probability of that hypothesis. """ score, learned, guess = \ data['score'], data['learned'], data['guess'] return (score * calculate_correct(guess, hypothesis, learned) + (1 - score) * calculate_incorrect(guess, hypothesis, learned))
def slip_normal(score, guess, slip, learned): if score == 1: return calculate_correct(guess, slip, learned) if score == 0: return calculate_incorrect(guess, slip, learned)
def slip_likelihood(score, guess, slip, learned): if score == 1: return calculate_correct(guess, 1, learned) if score == 0: return calculate_incorrect(guess, 1, learned)