Minimal multi-armed bandit helpers: pure exploration & pure exploitation.
Project description
mab-lite-dhruv
Minimal multi-armed bandit helpers for pure exploration and pure exploitation.
Perfect for teaching, quick baselines, and sanity checks.
Features
- Pure exploration: uniform random arm pulls for
ttrials - Pure exploitation: always pull one arm (optionally specify which)
- Reproducible: optional
seed - History: returns per-arm counts, rewards, and (arm, reward) history
Installation
pip install mab-lite-dhruv
## Test the installation
After installing, you can quickly verify the package works:
```python
# test_mab.py
from mab_lite_dhruv import pure_exploration, pure_exploitation
import numpy as np
n, t = 5, 20
true_probabilities = np.random.rand(n).tolist()
print("True probabilities:", true_probabilities)
# Pure exploration
pe_counts, pe_rewards, pe_history = pure_exploration(n, t, true_probabilities, seed=42)
print("\n--- Pure Exploration ---")
print("Arm counts:", dict(pe_counts))
print("Arm rewards:", dict(pe_rewards))
print("History sample:", pe_history[:5])
# Pure exploitation
px_counts, px_rewards, px_history = pure_exploitation(n, t, true_probabilities, seed=42)
print("\n--- Pure Exploitation ---")
print("Arm counts:", dict(px_counts))
print("Arm rewards:", dict(px_rewards))
print("History sample:", px_history[:5])
print("\n✅ Tests finished successfully.")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
mab_lite_dhruv-0.1.2.tar.gz
(2.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mab_lite_dhruv-0.1.2.tar.gz.
File metadata
- Download URL: mab_lite_dhruv-0.1.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3acfc685d40317aac96d501f7669ffd2ae8e0ad18ebd16fea8860d225b4acff
|
|
| MD5 |
9ef4ce2c110196e8ad43cb53a634fe6a
|
|
| BLAKE2b-256 |
51f2d624675bfa92c900c8e0fcb6446f245c3d30f8c8434ea2051ab0f984c793
|
File details
Details for the file mab_lite_dhruv-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mab_lite_dhruv-0.1.2-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe249665d95389acb42fc86d26ab107610eb56915c2ff55a2cc1dd530aa383e9
|
|
| MD5 |
0784a4916e928b31f2cb327e85720787
|
|
| BLAKE2b-256 |
596d925f7cbbb818da467af1344e7f683aa71af3abdbae3de73e41aaed8eb0dc
|