Skip to content

Instantly share code, notes, and snippets.

@James-E-A
Last active May 9, 2021 01:22
Show Gist options
  • Save James-E-A/5bbdbfa27609d96132a10ccdafd6d058 to your computer and use it in GitHub Desktop.
Save James-E-A/5bbdbfa27609d96132a10ccdafd6d058 to your computer and use it in GitHub Desktop.
fair, symmetric scoring rule
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