Skip to content

Instantly share code, notes, and snippets.

@lylayang
Last active October 3, 2019 19:20
Show Gist options
  • Save lylayang/5eb73934a2461b159d376ceac26f9b9f to your computer and use it in GitHub Desktop.
Save lylayang/5eb73934a2461b159d376ceac26f9b9f to your computer and use it in GitHub Desktop.
import numpy as np
import matplotlib.pyplot as plt
# score in test are 10% greater than ctrl (per record)
# ctrl has 5x the number of records as test and10% lift in test
lift = 1.1
test = np.random.binomial(100, p=0.2 * lift, size=10000) * 1.0
ctrl = np.random.binomial(100, p=0.2, size=50000) * 1.0
bins = np.linspace(0, 40, 20)
plt.hist(ctrl, bins=bins, label='Control')
plt.hist(test, bins=bins, label='Test', color='orange')
plt.title('Test/Ctrl Data')
plt.legend()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment