def empirical_lift(variations, control=None):
    """Calculate empirical lift E[(B-A)/A]."""
    values = OrderedDict()
    a, others = _split(variations, control)
    for label, b in others.items():
        total_a = a.alpha-a.prior_alpha+a.beta-a.prior_beta
        total_b = b.alpha-b.prior_alpha+b.beta-b.prior_beta
        p_a = float(a.alpha-a.prior_alpha) / total_a
        p_b = float(b.alpha-b.prior_alpha) / total_b
        lift = (p_b - p_a) / p_a
        values[label] = lift

    return values
dataset/ETHPy150Open bogdan-kulynych/trials/trials/stats.py/empirical_lift/original