This repository implements FiveThirtyEight's NFL Elo forecasting model and evaluation framework. The data lineage flows from two raw CSV sources: `data/nfl_games.csv` containing historical game results (1920-present) with pre-computed Elo win probabilities, and `data/initial_elos.csv` providing starting Elo ratings for each franchise. The `forecast.py` module implements the core Elo engine: it initializes team ratings, applies season-to-season reversion (retaining 2/3 of prior rating, reverting 1/3 toward 1505), incorporates home-field advantage (65 Elo points), and updates ratings post-game using a margin-of-victory multiplier (log(pd+1) * 2.2/(elo_diff*0.001+2.2)). Special hardcoded reversions handle franchise relocations/expansions. The `util.py` module handles CSV parsing with type coercion and evaluates forecasts using a Brier-score-based points system (25 - 100*brier, doubled for playoffs). The `eval.py` script orchestrates the full pipeline: load games, generate forecasts, evaluate against FiveThirtyEight's baseline. The repo answers the research question: 'Can alternative forecasting models beat FiveThirtyEight's Elo model on historical NFL data?'
This repository provides a Python library and CLI tool for optimizing daily fantasy sports (DFS) lineups on DraftKings and FanDuel. It reads player salary and projection data from CSV files, enforces contest-specific constraints (salary cap, position limits, custom rules like stacks and exposure), and uses Google OR-Tools to solve the constrained optimization problem, producing lineups that maximize projected points. The library supports a wide range of sports (NFL, NBA, MLB, NHL, soccer, golf, NASCAR, tennis, CS:GO, F1, XFL, and various Showdown/Pickem contest types) and includes utilities for downloading salary CSVs and generating upload files for mass lineup entry. The architecture is a classic monolithic Python package with a clear separation of concerns: data parsing (`csv_parse/`), player pool construction (`player_pool.py`), constraint definition (`lineup_constraints.py`, `settings.py`), optimization core (`optimizer.py`), and output formatting (`orm.py`, `uploaders.py`). The test suite is comprehensive with sport-specific tests and CSV fixtures. The codebase demonstrates practical application of constraint programming to a real-world combinatorial optimization problem, though some components are tightly coupled to the DFS domain.