Commit Graph

23 Commits

Author SHA1 Message Date
ramseshk 8e759b0d0f Project Al-Cihred: ML auction strategy with exact 500cr spend
- LightGBM trained on 11,300 per-matchday votes (R²=0.147, RMSE=1.19)
- MILP with exact 499-500cr budget: 3GK+8DEF+8MID+6FWD
- Practical constraints: 2 starting GKs, 21/25 reliable (>15g)
- Realistic prices: Lautaro 229cr, Malen 220cr, Douvikas 56cr
- Squad: Svilar(21)+Carnesecchi(18)+Christensen(1)=40GK · 8DEF 128cr · 8MID 152cr · 6FWD 180cr
- Every player has 2-3 alternatives
- Updated dashboard auction page to load the plan
2026-08-11 16:20:45 +08:00
ramseshk 6c1fb46e8a Fix auction: realistic valuations, multi-strategy comparison, role chips rendering
- Realistic price model: scales by FVM (Lautaro FVM=370 → ~199 cr, QI×5.7)
  Formula: qi * max(1.2, fvm/65) with forward premium and small-sample penalty
- 5 strategy engines: Balanced, Value, Stars, Safe, MILP-Lite
  Each with different score functions (value ratio, stability, risk adj)
- Strategy comparison radar grid: total FV, efficiency, stars, avg games, budget%
- Squad table with color-coded price bands (gold >100cr, sky >50cr, green <50cr)
- Market distribution histogram by role
- Top value picks section with cr/FV efficiency
- Fixed role_chip HTML rendering in all pages (unsafe_allow_html=True)
- Verified: 0 errors, 31 role chips, 5 KPIs, 8 charts
2026-08-11 16:13:38 +08:00
ramseshk 356b8d4c49 Add run_dashboard.sh launcher script + auto warehouse export
- run_dashboard.sh: one-command launcher with auto warehouse export
- Sets correct working directory and streamlit flags
- All 49 tests passing. 344 dataset files committed.
2026-08-11 15:49:30 +08:00
ramseshk 30d676517e Fix Players page KeyError + use_container_width deprecation
- Players page: fix regression_chart xg_col default (goals_p90 -> xg_p90)
- charts.py: make regression_chart defensive against missing columns
- All pages: replace use_container_width=True with width='stretch'
- Verified: all 5 pages render with zero errors via Playwright browser test
2026-08-11 15:24:39 +08:00
ramseshk 397078d635 Fix dashboard imports for Streamlit multi-page routing
- Add sys.path.insert at top of app.py and all 5 page files
- Fix .streamlit/config.toml CORS/XSRF conflict
- Remove duplicate st.set_page_config from page files
- Verified: all pages import cleanly, dashboard boots via streamlit run
- All 49 tests passing (31 original + 18 dashboard)
2026-08-11 15:08:09 +08:00
ramseshk 65f5b66b05 Dashboard: Stadium Night design system, 5-page Streamlit app, warehouse exporter
- src/export/warehouse.py: reads scattered pipeline artifacts → 6 Parquet files
  (players, fixtures, predictions, lineups, votes, model_metrics)
- dashboard/warehouse.py: read-only cached Parquet loader
- .streamlit/config.toml: dark theme base, server config
- dashboard/viz/template.py: Plotly 'fantabeto_dark' template (single source of truth)
  - Semantic palette: pitch_green #00D084, gold #FFC94D, red #FF4D5E, sky #38BDF8
  - Space Grotesk headers, Inter body, tabular numerals
  - All 10 chart colors banned from default palette
- dashboard/viz/components.py: KPI cards, role chips, section headers, CSS injection
- dashboard/viz/charts.py: 10 pure chart functions (df → Figure)
  - percentile radar, fixture heatmap, regression comparison, bonus donut
  - card risk gauge, budget waterfall, value scatter, error violins
- dashboard/viz/pitch.py: SVG pitch component — dark turf gradient,
  player badges sized by FV, gold captain ring, bench strip, formation label
- 5 pages:
  - 01_matchday: KPI sparklines, fixture heatmap, start/sit grid, bump chart
  - 02_players: search, radar, regression, bonus/malus, card risk, news feed
  - 03_auction: budget slider, waterfall, value scatter, grid auction heatmap
  - 04_lineup: SVG pitch, what-if toggles, opponent mirror, MCTS captain
  - 05_lab: error violins, feature importance, calibration curve, backtest
- dashboard/app.py: multi-page Streamlit entry with sidebar navigation
- dashboard/tests/test_dashboard.py: 18 unit tests (warehouse, template, charts, pitch)
- DASHBOARD.md: full architecture docs, design system reference
- 49 total tests passing (31 existing + 18 dashboard)
2026-08-11 14:53:51 +08:00
ramseshk 68670889c7 Full 25/26 dataset: 38 matchdays of votes + season stats + ML predictions
- Added new_data/ with complete 2025/26 Fantacalcio dataset:
  - 38 matchday vote files (Voti_*_Giornata_1-38.xlsx) = 12,049 per-player votes
  - Statistiche 2025/26 (663 players) and 2026/27 (507 players)
- Built comprehensive per-match training dataset from vote files
- Expert model: real 25/26 FV baselines + home/away + opponent strength adj
- Generated 505 Matchday 1 predictions with differentiated FV scores
- Top 5: Malen (9.11), Martinez L. (8.43), Thuram (8.13), Dimarco (7.82), Calhanoglu (7.82)
- MCTS Starting XI: Captain Malen, 4 Inter (home vs Monza), 93.1 expected pts
- All 31 tests passing
2026-08-11 14:31:40 +08:00
ramseshk 4702571285 Run pipeline: live 26/27 data + real 25/26 stats, expert model predictions
- Updated 26_27_teams.yaml with confirmed teams from live Fantacalcio.it (Venezia,
  Frosinone, Sassuolo, Parma, Como — all 20 teams confirmed)
- Fixed FantacalcioScraper HTML roster parser to match live quotazioni page structure
  (data-filter-role-classic, player-row tr elements)
- Added 26/27 Quotazioni_Fantacalcio: 505 players with FVM values, QI/QA prices
- Scraped real 25/26 season stats from statistiche-serie-a (663 players)
- Built expert model using real 25/26 FV baselines + home/away adj + opponent strength
- Generated Matchday 1 predictions for 388 matched players
- MCTS lineup optimization: Captain Malen (Roma, 9.67 FV), 98.1 expected pts
- All 31 tests passing
2026-08-11 14:13:01 +08:00
ramseshk 3b065775f5 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
2026-08-11 13:16:07 +08:00
Giuseppe Musicco 6d9167596c Update matchday #8 2023-10-05 19:41:20 +02:00
Giuseppe Musicco 3e9080e07d Matchday #7 2023-09-30 09:24:58 +02:00
Giuseppe Musicco 09a0e33af5 Serie A 23/24 matchday 5 2023-09-21 07:51:22 +02:00
Giuseppe Musicco caf7754be7 Code updated for Serie A 2023/2024
- Reorganization of data folders
- Code adapted for the new Serie A season, also considering only a small number of league games has been played
- Stats from other leagues are considered for players at their first Serie A season (rookies), for now without any adaptation based on league difficulty
- Minor fixes
2023-09-09 19:36:56 +02:00
Giuseppe Musicco 1492328958 Code updated for Serie A 2023/2024
- Reorganization of data folders
- Code adapted for the new Serie A season, also considering only a small number of league games has been played
- Stats from other leagues are considered for players at their first Serie A season (rookies), for now without any adaptation based on league difficulty
- Minor fixes
2023-09-09 19:31:52 +02:00
Giuseppe Musicco 2ea1b65972 Update README.md 2023-07-11 08:37:47 +02:00
Giuseppe Musicco 99fb244c26 Matchday 34 2023-05-06 09:12:45 +02:00
Giuseppe Musicco 4dc3df3ec2 Matchdays 32 and 33 + notebook for Lineup simulation 2023-04-29 10:39:31 +02:00
Giuseppe Musicco 09302a08e4 Update matchday 22 + code fixed for new FBRef data and Fantacalcio probable lineups 2023-02-11 08:44:48 +01:00
Giuseppe Musicco 8f7df5dd7f Minor update (matchday 21)
- updated code for new FBRef stats;
- updated players list;
- players who changed team handled slightly better
2023-02-04 13:10:39 +01:00
Giuseppe Musicco bfdc38b7d6 Merge branch 'main' of https://github.com/uPeppe/fantabeto 2023-01-28 11:09:15 +01:00
Giuseppe Musicco c4a50cecd2 Update Jan before matchday 20 2023-01-28 11:06:11 +01:00
Giuseppe Musicco 0a2121b0fc Update after matchday 15 2022-11-15 20:10:35 +01:00
Giuseppe Musicco b60a8a061c Release 2022-11-12 11:29:20 +01:00