Skip to main content

abito

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.

Features
  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.

Installation

pip install abito

Usage

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.mean())
print(sample.std())
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)

print(sample.t_test(sample_control))
print(sample.mann_whitney_u_test(sample_control))

Bootstrap

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.reweigh(inplace=True)
sample_control.reweigh(inplace=True)
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.

Compress

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()

Metadata

Release files for abito 0.1.3

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for abito 0.1.3
File Size Uploaded Provenance Actions
abito-0.1.3.tar.gz 12.2 kB Without provenance Details for abito-0.1.3.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for abito 0.1.3
File Interpreter ABI Platform Actions
abito-0.1.3-py3-none-any.whl Python 3 none any Details for abito-0.1.3-py3-none-any.whl

Total release size: 26.5 kB

Release files / abito-0.1.3.tar.gz

Download URL abito-0.1.3.tar.gz
Size 12.2 kB
Tags Source
SHA-256 checksum
How to use checksums
c4c851fca8482a1f3cd9fba3622244780f987bce17ff9c9ec22088e281b606a3
BLAKE2b-256 checksum
How to use checksums
7cad8a631821b1f0d93d62f87ce0013d866ced16c3371b6be3df42c685256bc0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8

Release files / abito-0.1.3-py3-none-any.whl

Download URL abito-0.1.3-py3-none-any.whl
Size 14.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4b8dfc6ee76edcd512ccad2ade2eae96a113544990e45c261b0b237d7027f58d
BLAKE2b-256 checksum
How to use checksums
52cf999a23169211230415179515ee6553f78a02bbe70fc7fa91bc8fa81e629f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.1.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.6.8

Security for abito 0.1.3

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page