Skip to main content

BayesMAB

Bayesian Multi-Armed Bandit with adaptive Thompson Sampling, suitable for A/B testing and real-time decision-making.

Install

pip install bayesmab

Usage Example

An example script is included in the examples/ directory.

You can run it with:

python examples/run_bernoulli_bandit.py

The example initializes a bandit with three arms, each simulating a different true conversion rate. It uses:

  • Thompson Sampling to allocate "traffic" to each arm based on uncertainty

  • Updates posterior beliefs as binary rewards are observed

  • Tracks and visualizes:

    • Posterior distributions

    • Posterior mean estimates over time

    • Cumulative regret

    • Traffic allocation per arm

This simulates an A/B/n test where better-performing variants gradually receive more attention, showing how Bayesian bandits adaptively optimize decisions under uncertainty.

Metadata

Release files for bayesmab 1.0.0

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

Source distribution (sdist)

Source distribution for bayesmab 1.0.0
File Size Uploaded Provenance
bayesmab-1.0.0.tar.gz 3.7 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 7.8 kB

Release files / bayesmab-1.0.0.tar.gz

Download URL bayesmab-1.0.0.tar.gz
Size 3.7 kB
Tags Source
SHA-256 checksum
How to use checksums
80ac158bb9f7a99e3bb1f6e881047e861ce23c33a80922ca6f685f32b175bb89
BLAKE2b-256 checksum
How to use checksums
8be545152241d386a8913b960394305650afba69c12d401da99426d4a27650b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.9

Release files / bayesmab-1.0.0-py3-none-any.whl

Download URL bayesmab-1.0.0-py3-none-any.whl
Size 4.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e0898f8f3510d2128fd0f3362032b4679c956461303d5561798d9d85a265c18
BLAKE2b-256 checksum
How to use checksums
b6dcadf3fed599fac20b7df5d8bafa6ca87c2fc7177615ad6590c9ac09597a73
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.10.9

Security for bayesmab 1.0.0

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.

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files No provenance

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