Last active
August 29, 2015 13:59
-
-
Save ma2rten/10588839 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from __future__ import division | |
from math import log | |
def p_ben(n, history_length): | |
p_remove = .3 | |
p_keep = 1 - p_remove | |
if n == 1: | |
return 0. | |
if n == history_length: | |
return p_keep ** (n-2) | |
return p_keep ** (n-2) * p_remove | |
def p_utnapishtim(n, history_length): | |
if n < 2: | |
return 0. | |
censored = history_length - n | |
normalization = sum(log(k) for k in range(2, history_length+1)) | |
return log(censored + 2) / normalization |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment