Major refactor: Fantabeto 26/27 — modular package, GBM ensemble, MILP/MCTS optimization

Phase 1: Data Engineering
- Refactored notebooks into src/{scraper,features,models,optimization,bot}
- FBref scraper with proxy rotation + Playwright Cloudflare bypass
- Fantacalcio.it integrated scraper (authenticated API + HTML fallback)
- api-football RapidAPI client for supplementary xG/xA/injuries
- RAG news pipeline: Gazzetta, Sky Sport, Di Marzio → injury/suspension/tactical extraction
- 26/27 season config: teams, scoring rules, name mappings, news sources

Phase 2: SOTA ML Architecture
- GBM Ensemble (LightGBM + CatBoost + XGBoost) with stacked blending
- Bootstrap ensemble for uncertainty quantification
- SinhArcsinh distribution head (ported from original TF Probability)
- Card classifiers (yellow/red), penalty model, goal probability (Poisson)
- Temporal GNN for player interaction modeling (crosses→goals, passes→assists)
- Optuna hyperparameter tuning with time-series CV

Phase 3: Operations Research
- Auction solver: MILP knapsack with PuLP (budget + role constraints)
- Grid Auction (Asta a Griglia): Minimax game theory bidding strategy
- Weekly lineup optimizer: MCTS maximizing win probability vs opponent
- Modificatore Difesa integration + captain selection
- Transfer market analyzer: buy-low/sell-high via xG regression to mean
- Opponent behavior modeling from historical lineage patterns

Phase 4: Agentic Workflow
- Telegram bot: auto-briefing (Friday + Sunday morning)
- Tactical briefing generator with start/sit recommendations
- GitHub Actions CI/CD: scheduled pipeline (scrape → predict → notify)

Infrastructure:
- 31 pytest unit tests (features, models, scraper, optimization)
- requirements.txt (lightgbm, catboost, xgboost, optuna, pulp, playwright, langchain)
- Makefile with install/test/lint/scrape/train/bot targets
- Jupyter notebook: 26_27_strategy.ipynb demonstrating auction + matchday 1 mockup
- Completely rewritten README.md with architecture diagram
This commit is contained in:
ramseshk
2026-08-11 13:16:07 +08:00
parent 6d9167596c
commit 3b065775f5
44 changed files with 5754 additions and 57 deletions
+40
View File
@@ -0,0 +1,40 @@
# Fantacalcio scoring rules (FVM standard)
scoring:
goal: 3.0 # +3 per goal scored
assist: 1.0 # +1 per assist
yellow_card: -0.5 # -0.5 per yellow card
red_card: -1.0 # -1 per red card
own_goal: -2.0 # -2 per own goal
penalty_saved: 3.0 # +3 for GK penalty save
penalty_missed: -3.0 # -3 for missed penalty
clean_sheet_gk: 1.0 # +1 for GK clean sheet (min 45min)
goals_conceded_gk: -1.0 # -1 per goal conceded (GK)
modificatore_difesa:
# Average of best 3 defender votes
threshold_6_0: 1 # +1 if avg >= 6.0
threshold_6_5: 3 # +3 if avg >= 6.5
threshold_7_0: 6 # +6 if avg >= 7.0
roles:
P: goalkeeper
D: defender
C: midfielder
A: forward
roster_quotas:
P: 3 # 3 goalkeepers
D: 8 # 8 defenders
C: 8 # 8 midfielders
A: 6 # 6 forward
starting_lineup_quotas:
P: 1 # 1 goalkeeper
D: 3 # minimum 3 defenders (varies by formation)
D_max: 5
C: 3
C_max: 5
A: 1
A_max: 3
fantavoto_formula: "vote + goals*3 + assists*1 - yellow*0.5 - red*1"