Getting Started
Clone the repository and set up the environment:
git clone https://example.com/rl-explained-code.git
cd rl-explained-code
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install -r requirements.txt
Minimal Bandit Example
# epsilon_greedy.py
import random
import statistics
def run(eps=0.1, steps=1000, arms=[0.1, 0.3, 0.6]):
Q = [0.0]*len(arms); N = [0]*len(arms)
rewards=[]
for t in range(steps):
a = random.randrange(len(arms)) if random.random()