Skip to main content

Multi-armed bandit

Python PyPI Version License Downloads Downloads DOI Sphinx

  • Thompson is Python package to evaluate the multi-armed bandit problem. In addition to thompson, Upper Confidence Bound (UCB) algorithm, and randomized results are also implemented. The thompson package implements three algorithms for solving the multi-armed bandit problem:
  1. Thompson Sampling: A Bayesian approach that maintains probability distributions over the expected rewards of each arm and samples from these distributions to select the next arm to pull.

  2. Upper Confidence Bound (UCB): A deterministic algorithm that selects arms based on their estimated rewards and the uncertainty in those estimates.

  3. Randomized Sampling: A baseline method that randomly selects arms without considering their past performance.

The multi-armed bandit problem is a classic reinforcement learning problem that exemplifies the exploration-exploitation tradeoff dilemma. In this problem, a fixed limited set of resources must be allocated between competing choices in a way that maximizes expected gain, when each choice's properties are only partially known at the time of allocation.

⭐️ Star this repo if you like it ⭐️

Install thompson from PyPI

pip install thompson

Import thompson package

import thompson as th

Documentation pages

On the documentation pages you can find detailed information about the working of the thompson with examples.


Examples

Developing with Agentic Skills

The bundled developing-with-streamlit skill helps you integrate AI agents directly into your Streamlit applications for automated development, debugging, and documentation generation.

Installation

The skill ships bundled inside the thompson package. It is automatically available when you install Thompson from PyPI:

pip install thompson

In you working directory install the skill. No additional installation steps are required — the skill references are included in every release.

thompson install skill

Maintainer

  • Erdogan Taskesen, GitHub: erdogant
  • Contributions are welcome.
  • Yes! This library is entirely free, but it runs on coffee! :) Feel free to support with a Coffee.

Buy me a coffee

Release files for thompson 1.2.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 thompson 1.2.0
File Size Uploaded
thompson-1.2.0.tar.gz 35.9 kB Details

Built distribution (wheel)

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

Total release size: 70.8 kB

Release files / thompson-1.2.0.tar.gz

Download URL thompson-1.2.0.tar.gz
Size 35.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4ae1057c2992cf33a8d8f8fc25483671315ab37b0d0b4a1e27668d375d71d716
BLAKE2b-256 checksum
How to use checksums
161a091cd3bab7a6bdec30d0e2e3826e8dd1c296f3a031077a33670627283409
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release files / thompson-1.2.0-py3-none-any.whl

Download URL thompson-1.2.0-py3-none-any.whl
Size 34.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7781d201d3cb87603b41746cf69c95dcfcafb41083560e07ae04943c198024f7
BLAKE2b-256 checksum
How to use checksums
c52f1e7a06f0dc6817ec43c21d5cfe0170ad2dc1cee992604cbf0f5f166ec7c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.14

Release history Release notifications | RSS feed

This release

1.2.0 This release

2 release files

1.1.0

2 release files

1.0.0

2 release files

0.1.2

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