Skip to main content

Package for hypothesis testing in A/B-experiments

Project description


Build Status Coverage Status

Python package for hypothesis testing. Suitable for using in A/B-testing software. Tested for Python >= 3.5. Based on numpy and scipy.

  1. Convenient interface to run significance tests.
  2. Support of ratio-samples. Linearization included (delta-method).
  3. Bootstrapping: can measure significance of any statistic, even quantiles. Multiprocessing is supported.
  4. Ntile-bucketing: compress samples to get better performance.
  5. Trim: get rid of heavy tails.


pip install abito


The most powerful tool in this package is the Sample:

import abito as ab

Let's draw some observations from Poisson distribution and initiate Sample instance from them.

import numpy as np

observations = np.random.poisson(1, size=10**6)
sample = ab.sample(observations)

Now we can calculate any statistic in numpy-way.

print(sample.quantile(q=[0.05, 0.95]))

To compare with other sample we can use t_test or mann_whitney_u_test:

observations_control = np.random.poisson(1.005, size=10**6)
sample_control = Sample(observations_control)



Or we can use bootstrap to compare any statistic:

sample.bootstrap_test(sample_control, stat='mean', n_iters=100)

To improve performance, it's better to provide observations in weighted form: unique values + counts. Or, we can compress samples, using built-in method:

sample.bootstrap_test(sample_control, stat='mean', n_iters=10000)

Now bootstrap is working lightning-fast. To improve performance further you can set parameter n_threads > 1 to run bootstrapping using multiprocessing.


observations = np.random.normal(100, size=10**8)
sample = ab.sample(observations)

compressed = sample.compress(n_buckets=100, stat='mean')

%timeit sample.std()
%timeit compressed.std()

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

abito-0.1.3.tar.gz (12.2 kB view hashes)

Uploaded source

Built Distribution

abito-0.1.3-py3-none-any.whl (14.3 kB view hashes)

Uploaded py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page