Skip to main content

ablisk

This package aims to make it easier for data scientists, analysts, and engineers to conduct statistically sound experiments. At its core is the ABLisk class. This class provides tools for designing, analyzing, and simulating A/B tests.


Features

  • Sample Size Calculation: Calculate the minimum required sample size.
  • Result Analysis: Retrieve and visualize experiment results with support for confidence intervals and kernel density estimates (KDEs).
  • Recommendation: Generate results summary and recommendations based os results.

Class Overview

ABLisk

The main class provides the following methods and attributes:

Initialization

ABLisk(bcr, mde, alpha = 0.05, power = 0.8, is_absolute_variation: bool = True, is_two_tailed: bool = True)
  • bcr: Baseline Conversion Rate (0 <= mde < 1).
  • mde: Minimum Detectable Effect (absolute or relative) (0 < mde < 1).
  • alpha: Significance level (default: 0.05).
  • power: Statistical power (default: 0.8).
  • is_absolute_variation: Whether mde is absolute (default: True).
  • ** is_two_tailed**: Use two-tailed tests (default: True).

Methods

  1. get_sample_size()

    • Calculates the minimum required sample size.
  2. get_experiment_results(n_ctrl, p_ctrl, n_trmt, p_trmt, plot, full_summary, from_dataset, dataset)

    • Analyzes and visualizes results.
    • Parameters:
      • n_ctrl, n_trmt: Sample sizes of the control and treatment groups.
      • p_ctrl, p_trmt: Conversion rates for control and treatment groups.
      • plot: for visualization('KDE' or 'Confidence Intervals') or results summary and recommendations (None).
      • full_summary: whether to pass the results summary as a string (to be printed) or as a tuple containing pieces of this same summary.
      • from_dataset: whether to get sample size and proportions from an experiment dataset or bay manually inserting in their respective arguments.
      • dataset: the csv file path or DataFrame with three arbitrary named columns describing the user ID, the variants ("treatment" or "control"), and whether the user as converted ({"yes", "no"} case-insensitive, 1, 0)

Usage

Installation

pip install ablisk

Importing the module

from ablisk.core import ABLisk

Example: Calculate Sample Size

ab_test = ABLisk(bcr = 0.1, mde = 0.02, alpha = 0.05, power = 0.8)
sample_size = ab_test.get_sample_size()
print(f"Required Sample Size: {sample_size}")

Example: Visualize Experiment Results

ab_test.get_experiment_results(n_ctrl = 500, p_ctrl = 0.1, n_trmt = 500, p_trmt = 0.12, plot_type = 'Error Bars')

💡 A more detailed example regarding the implementation of this tool is available on its respective notebook. You can view the notebook using nbviewer due to GitHub rendering limitations here.


License

This project is licensed under the MIT License. See the LICENSE file for details.


Contribution

Contributions are welcome! Please fork the repository, create a feature branch, and submit a pull request.


References


Acknowledgments

This project would not be possible without the massive contribution of Evan Miller regarding A/B testing methodologies and tools. Refer to his A/B Testing Sample Size Calculator for further details.


Explore the Web App 🌐🚀

ablisk is the statistical engine of xplendid – the AI-assisted web application version for this module.

Networking

Connect with me:

/domingosdeeulariadumba

/domingosdeeulariadumba

/domingosdeeulariadumba

Metadata

Release files for ablisk 0.2.4

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

Source distribution (sdist)

Source distribution for ablisk 0.2.4
File Size Uploaded
ablisk-0.2.4.tar.gz 12.9 kB Details

Built distribution (wheel)

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

Total release size: 22.9 kB

Release files / ablisk-0.2.4.tar.gz

Download URL ablisk-0.2.4.tar.gz
Size 12.9 kB
Tags Source
SHA-256 checksum
How to use checksums
814aa79de3585a726e4f12f43c164da68c5902cf9f2dd92ea7b25d27bde0d252
BLAKE2b-256 checksum
How to use checksums
175447d8ea97225dbe26ac4f53fcd18adffc26e73abcf226b96a55ea0e4a519a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / ablisk-0.2.4-py3-none-any.whl

Download URL ablisk-0.2.4-py3-none-any.whl
Size 10.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9169a7822fc568df3347eef4af6f4bacea46b17df522b8bb966b640be614965c
BLAKE2b-256 checksum
How to use checksums
28e651096a62e71e95a01eb33c9879ac58558a6d8c7413505f38615eeda881a0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.2.4 This release

2 release files

0.1.9

2 release files

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