Add your description here
Project description
rlcmab-lab3-sampler
A reward sampler for Contextual Bandit news recommendation systems.
Installation
pip install rlcmab-lab3-sampler
Or install from source:
cd sampler
pip install .
Quick Start
from sampler import sampler
# Initialize with your roll number (i)
reward_sampler = sampler(i=42)
# Get a reward from arm j
reward = reward_sampler.sample(j=5)
print(reward)
# Sample a few arms
for j in range(3):
print(j, reward_sampler.sample(j))
API Reference
sampler(i, n_arms=12)
Initialize a new sampler instance.
Parameters:
i(int): Student ID used to seed the random number generatorn_arms(int, optional): Number of arms/articles. Default: 12
Attributes:
means: List of mean values for each Gaussian distributionstds: List of standard deviations for each Gaussian distributiondistributions: List of scipy.stats.norm distribution objects
sample(j)
Sample a reward from the specified arm.
Parameters:
j(int): Arm index (must be between 0 and 11)
Returns:
float: Reward value sampled from the arm's Gaussian distribution
Raises:
ValueError: Ifjis not in the valid range [0, 11]
Reproducibility
For the same student ID i, the generated arm distributions remain the same
across runs. Different student IDs map to different distributions.
License
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
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 rlcmab_sampler-0.1.0.tar.gz.
File metadata
- Download URL: rlcmab_sampler-0.1.0.tar.gz
- Upload date:
- Size: 1.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ee0b54a20bd7879fff028a17c78dfdb7d0969e868e9adfe6d1e72faf9e0baf7
|
|
| MD5 |
090d7d9c90a637719e5321f935272b16
|
|
| BLAKE2b-256 |
e215d7be38fcbbb263c5d90bc91c2a53032bea2c3a861fdd6bc76cd624a41fd6
|
File details
Details for the file rlcmab_sampler-0.1.0-py3-none-any.whl.
File metadata
- Download URL: rlcmab_sampler-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.11 {"installer":{"name":"uv","version":"0.9.11"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c80b8197cf48f092b741742862197aa1454fe10fff5bb120610538faf511f3ab
|
|
| MD5 |
b302f0c67c0f3003a4d2759b6a693d98
|
|
| BLAKE2b-256 |
05583de3e5833e2e4d28f55548f591c7d5c09c522af4dc74493206982cc9ea4a
|