aboba Documentationpython library for A/B testing, developed by Thetahat team

aboba Documentation

Welcome to the aboba Python library documentation - an AB testing library with simplicity in mind.

Installation

pip install aboba

Quick Start

import numpy as np
import pandas as pd
import scipy.stats as sps

from aboba import (
    tests,
    samplers,
    effect_modifiers,
    experiment,
)
from aboba.pipeline import Pipeline

# Create dataset with two groups
data = pd.DataFrame({
    'value'  : np.concatenate([
        sps.norm.rvs(size=1000, loc=0, scale=1),
        sps.norm.rvs(size=1000, loc=0, scale=1),
    ]),
    'is_b_group': np.concatenate([
        np.repeat(0, 1000),
        np.repeat(1, 1000),
    ]),
})

# Configure test
test = tests.AbsoluteIndependentTTest(
    value_column='value',
)

# Create pipeline with sampler
sampler = samplers.GroupSampler(
    column='is_b_group',
    size=100,
)
pipeline = Pipeline([
    ('sampler', sampler),
])

# Run experiment
n_iter = 500
exp = experiment.AbobaExperiment(draw_cols=1)

group_aa = exp.group(
    name="AA, regular",
    test=test,
    data=data,
    data_pipeline=pipeline,
    n_iter=n_iter
)
group_aa.run()

effect = effect_modifiers.GroupModifier(
    effects={1: 0.3},
    value_column='value',
    group_column='is_b_group',
)

group_ab = exp.group(
    name="AB, regular, effect=0.3",
    test=test,
    data=data,
    data_pipeline=pipeline,
    synthetic_effect=effect,
    n_iter=n_iter
)
group_ab.run()

# Draw results
fig, axes = exp.draw()
fig.savefig('results.png')

General Architecture

The library follows a modular architecture with the following key components:

  • Data Sources: Provide data for experiments (DataFrames or custom generators)
  • Data Samplers: Control how data is sampled for testing
  • Data Processors: Transform data before testing (CUPED, bucketing, etc.)
  • Tests: Statistical tests for hypothesis testing
  • Effect Modifiers: Simulate synthetic effects for power analysis
  • Experiments: Orchestrate multiple test runs and visualizations

Features

  • Simple, intuitive API
  • Support for various statistical tests (t-tests, ANOVA, non-parametric tests)
  • Built-in variance reduction techniques (CUPED, stratification)
  • Power analysis and effect simulation
  • Experiment orchestration and visualization
  • Extensible architecture for custom components

Next Steps