Skip to content

Instantly share code, notes, and snippets.

@zackmdavis
Last active January 8, 2020 04:17
Show Gist options
  • Save zackmdavis/21884a721d146de55c4197ccb5225ab2 to your computer and use it in GitHub Desktop.
Save zackmdavis/21884a721d146de55c4197ccb5225ab2 to your computer and use it in GitHub Desktop.
# https://www.vox.com/future-perfect/2020/1/7/21051910/predictions-trump-brexit-recession-2019-2020
from math import log2 as lg
predictions = [
# summary, probability, outcome
("Trump in office", 0.9, True),
("No Dem frontrunner", 0.6, False),
("No US recession", 0.8, True),
("No border wall", 0.95, True),
("US murders decline", 0.8, True),
("Brexit on schedule", 0.8, False),
("Modi Indian PM", 0.6, True),
("India and China no recession", 0.7, True),
("Malaria decline", 0.8, True),
("No new UBI countries", 0.9, True),
("More meat", 0.6, True),
("National fake meat", 0.95, False),
("No autotaxis", 0.9, True),
("New DeepMind app", 0.5, True),
("Warming", 0.6, True),
("More carbon", 0.8, True),
]
def score_prediction(probability, outcome):
if outcome:
return lg(probability)
else:
return lg(1 - probability)
logarithmic_score = sum(
score_prediction(probability, outcome)
for _, probability, outcome in predictions
)
# Trump in office -0.15200309344504997
# No Dem frontrunner -1.3219280948873622
# No US recession -0.3219280948873623
# No border wall -0.07400058144377693
# US murders decline -0.3219280948873623
# Brexit on schedule -2.3219280948873626
# Modi Indian PM -0.7369655941662062
# India and China no recession -0.5145731728297583
# Malaria decline -0.3219280948873623
# No new UBI countries -0.15200309344504997
# More meat -0.7369655941662062
# National fake meat -4.321928094887361
# No autotaxis -0.15200309344504997
# New DeepMind app -1.0
# Warming -0.7369655941662062
# More carbon -0.3219280948873623
# score: -13.508976481318838 bits
# compared to chance: -16 bits
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment