Skip to content

Instantly share code, notes, and snippets.

@vsmelov
Created December 8, 2018 23:47
Show Gist options
  • Save vsmelov/fa9ad4f7e0a7228fcae01eca8706eece to your computer and use it in GitHub Desktop.
Save vsmelov/fa9ad4f7e0a7228fcae01eca8706eece to your computer and use it in GitHub Desktop.
import random
N_EXPERIMENTS = 10000
N_SWIPES = 250
A_REAL_RATE = 66 / 250
B_REAL_RATE = 70 / 250
def experiment():
""" observable rate for A and B """
a = sum(random.random() < A_REAL_RATE for i in range(N_SWIPES))
b = sum(random.random() < B_REAL_RATE for i in range(N_SWIPES))
return a, b
experiments_resuls = [experiment() for i in range(N_EXPERIMENTS)]
error_rate = sum(a > b for a, b in experiments_resuls) / N_EXPERIMENTS
print(f'error_rate = {error_rate}')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment