In [3]:
import pandas as pd
import scipy as sp
import daft
import matplotlib.pyplot as plt
import numpy as np
from abtools import ABtest, BernoulliModel
%matplotlib inline
In [4]:
p = .05
size = 200000
delta_true = .025
a = sp.stats.bernoulli.rvs(p=p, size=size, random_state=8228)
b = sp.stats.bernoulli.rvs(p=p*(1+delta_true), size=size, random_state=8228)
print('A - Mean: %.4f, std: %.2f' % (a.mean(), a.std()))
print('B - Mean: %.4f, std: %.2f' % (b.mean(), b.std()))
print('B better A on %.4f = %.4f%%' % (b.mean()- a.mean(), (b.mean()/a.mean()-1)*100))
In [5]:
test = ABtest([a, b], BernoulliModel, 5000)
test.test_all()
Out[5]:
In [6]:
test.probabilities_df
Out[6]:
In [7]:
test.plot()
In [ ]: