Last active
May 9, 2021 01:22
-
-
Save James-E-A/5bbdbfa27609d96132a10ccdafd6d058 to your computer and use it in GitHub Desktop.
fair, symmetric scoring rule
This file contains hidden or 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 random import random as r | |
#TODO: rewrite deterministically | |
def brier(pf=0.5, P=0.5, N=1024**2): | |
if callable(P): | |
o = P | |
elif hasattr(P, '__getitem__') | |
o = lambda t: P[t] | |
else: | |
o = lambda t: r()<P | |
return 1 - sum( (pf-o(t))**2 for t in range(N) )/N | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment