Skip to content

Instantly share code, notes, and snippets.

@hughdbrown
Last active October 2, 2015 15:39
Show Gist options
  • Save hughdbrown/e454548e0de9fd5c2108 to your computer and use it in GitHub Desktop.
Save hughdbrown/e454548e0de9fd5c2108 to your computer and use it in GitHub Desktop.
Data science: a-b-test
import numpy
import scipy.stats as scs
def a_b_test(new_views, new_clicks, old_views, old_clicks, size=10000):
new_site = scs.beta(a=new_clicks + 1, b=new_views + 1).rvs(size=size)
old_site = scs.beta(a=old_clicks + 1, b=old_views + 1).rvs(size=size)
return (new_site > old_site).mean()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment