Build a recommender that picks which article to show next, learning from simulated clicks. Compare random choice, epsilon-greedy and UCB by their cumulative regret, and see what happens when reader interests change over time.
Project idea · ungraded
Bandit-Based Recommender
You will use
Milestones
Build the smallest working version first. Ticks are saved in this browser only.
Stretch goals
- Implement Thompson sampling with Beta distributions.
- Add reader features (contextual bandits) with one linear model per article.
- Serve recommendations from a FastAPI endpoint that updates on click events.
Data
Everything is simulated with seeded NumPy generators, so experiments are reproducible.
Run it yourself
pip install numpy matplotlib
python bandits.py --strategy ucb --steps 10000