Skip to main content

A very simple Epsilon-Greedy Bandit RL example package

Project description

Simple RL Pack

A simple Python package demonstrating an Epsilon-Greedy Multi-Armed Bandit.

This package was created as an individual activity.

Usage

```python from simple_rl_pack import EpsilonGreedyBandit

Create a bandit with 3 arms

bandit = EpsilonGreedyBandit(num_arms=3, epsilon=0.1)

--- Simulate pulling arms ---

1. Select an action

action_to_pull = bandit.select_action()

2. Get a reward (in a real app, this comes from your environment)

Let's pretend arm 1 is the best

reward = 0.0 if action_to_pull == 1: reward = 1.0 elif action_to_pull == 2: reward = 0.5

3. Update the bandit's knowledge

bandit.update_value(action_to_pull, reward)

print(f"Pulled arm {action_to_pull}, received reward {reward}") print(f"Current best guess: Arm {bandit.get_best_arm()}") ```

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simple_rl_pack_kritarth04-0.0.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simple_rl_pack_kritarth04-0.0.1-py3-none-any.whl (3.3 kB view details)

Uploaded Python 3

File details

Details for the file simple_rl_pack_kritarth04-0.0.1.tar.gz.

File metadata

File hashes

Hashes for simple_rl_pack_kritarth04-0.0.1.tar.gz
Algorithm Hash digest
SHA256 86c0b4057187bfbebae427a43db6f5eff9ad52b5a1cb06108196eab479541e81
MD5 8d4074853aefbfa1576a49de593ad64f
BLAKE2b-256 193de6c876d4e1c6eaafece0f4c3df48b5d76211a292f873e33197b471ba3074

See more details on using hashes here.

File details

Details for the file simple_rl_pack_kritarth04-0.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_rl_pack_kritarth04-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f375d5c7f3bd3dd6e0bd04f294a57d0289ac62636a52f85e11e3eedc26184963
MD5 13be0b6723fb30443f5ae8a551c0542b
BLAKE2b-256 73a97a0bea830df6d0e35b6b2b07ccb42522be7e464ec25dff62470139ab4c43

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page