How xbhoomi-ar/fantasy-xi works
FantasyXI is an FPL decision-support product that predicts player points, chooses a weekly strategy, optimizes a legal squad and starting XI, then carries season state into the next gameweek. Its primary user workflow is the local browser demo: start a season, request subsequent gameweeks, and view the returned squad, transfers, chips and budget. The README also documents two interchangeable prediction models and a PPO-free historical baseline. The backend and frontend excerpts establish the demo wiring; some internal PPO-to-optimizer wiring is documented in the README but not shown in sampled source.
Main entry points: env.py PPO environment · historical_loop.py MILP baseline · rl_bridge.py RL bridge · interface.py Canonical predictions
Components 19
Prediction
- BiLSTM predictor
models/BiLSTM_model/gate_architecture/kaggle_dual_expert_full.py - XGBoost features
models/xgboost_model/src/fpl_predictor/features.py - XGBoost predictor
models/xgboost_model/src/fpl_predictor/train.py - Canonical predictions
rl_decision_layer/predictions/interface.py
Decision
- Candidate pipeline
rl_decision_layer/candidates/pipeline.py - PPO strategy
rl_decision_layer/ppo - PPO environment
rl_decision_layer/ppo/env.py
Optimization
- Squad MILP
rl_decision_layer/optimization/squad_milp.py - Starting XI
rl_decision_layer/optimization/starting_xi.py - Chip strategy
rl_decision_layer/optimization/chip_strategy.py
Season Runtime
- Historical environment
rl_decision_layer/environment/historical_env.py - Sequential season runner
rl_decision_layer/ppo/season_controller.py - MILP baseline
rl_decision_layer/historical_loop.py - Season session state
backend/rl_bridge.py
Other components
- Historical player data
- Browser user
Connections 23
- Historical player data → BiLSTM predictor: trains on
- Historical player data → XGBoost features: builds features
- XGBoost features → XGBoost predictor: provides features
- BiLSTM predictor → Canonical predictions: loads predictions
- XGBoost predictor → Canonical predictions: loads predictions
- Canonical predictions → Candidate pipeline: provides predictions
- Candidate pipeline → PPO environment: supplies candidates
- PPO strategy → PPO environment: policy acts in
- PPO environment → Squad MILP: strategy guides
- PPO environment → Chip strategy: chooses chip
- Squad MILP → Starting XI: selects squad for
- Sequential season runner → PPO environment: steps gameweeks
- Historical environment → Candidate pipeline: requests candidates
- MILP baseline → Historical environment: steps history
- MILP baseline → Squad MILP: requests decisions
- MILP baseline → Starting XI: selects starters
- MILP baseline → Canonical predictions: loads predictions
- Browser user → Demo UI: starts season
- Demo UI → FastAPI: calls API
- FastAPI → RL bridge: dispatches requests
- RL bridge → Sequential season runner: runs season
- RL bridge → Season session state: stores session
- Season session state → RL bridge: restores session