YAML Metadata Warning:empty or missing yaml metadata in repo card
Check out the documentation for more information.
The Effect of Optimism in the Face of Uncertainty
A Study of Optimistic Initialization in Multi-Armed Bandits
Project Structure
bandit-project/
βββ index.html β Main page (hero, theory, simulator, insights)
βββ style.css β All styles (dark theme, responsive layout)
βββ simulation.js β Core bandit engine (BanditEnv, EpsilonGreedyAgent, runSimulation)
βββ main.js β UI logic (Plotly charts, sliders, hero canvas)
How to Run
Just open index.html in any modern browser. No build step, no server needed.
# Option 1: Direct
open index.html
# Option 2: Local server (recommended)
python3 -m http.server 8080
# then visit http://localhost:8080
Algorithm
Ξ΅-Greedy with three initialization strategies:
| Strategy | Initial Qβ | Exploration drive |
|---|---|---|
| Optimistic | +5 to +20 | High (natural) |
| Normal | 0 | Medium (Ξ΅ only) |
| Pessimistic | β5 to β20 | Low |
Update rule: Q(a) β Q(a) + [R β Q(a)] / N(a) (incremental sample mean)
Parameters
| Parameter | Description | Range |
|---|---|---|
| K (arms) | Number of bandit arms | 2 β 10 |
| Iterations | Steps per simulation run | 100 β 3000 |
| Ξ΅ (epsilon) | Exploration probability | 0.00 β 0.50 |
| Runs | Repetitions averaged together | 1 β 50 |
| Ο (noise) | Reward standard deviation | 0.1 β 3.0 |
| Opt Qβ | Optimistic initial value | +1 to +20 |
| Pess Qβ | Pessimistic initial value | β1 to β20 |
Metrics Tracked
- Average reward over iterations (smoothed with rolling window)
- % Optimal action selected β how fast the agent finds the best arm
- Cumulative reward β total reward accumulated
- Arm selection heatmap β which arms each strategy visited most
Key Takeaways
- Optimism = free exploration β even with Ξ΅=0, optimistic agents explore all arms
- Faster convergence β optimistic agents discover the best arm sooner
- Pessimism is costly β premature commitment to a suboptimal arm
- Ξ΅ still matters β for non-stationary environments, keep Ξ΅ > 0
sanjay
- Plotly.js β interactive charts
- Google Fonts β Syne + Space Mono
Inference Providers NEW
This model isn't deployed by any Inference Provider. π Ask for provider support