Skip to content

BrandtCallahan/nfl-win-probability

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

104 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NFL Win Probability

1. File/Folder Setup

To set things up you and allow the code to run through appropriate data pulls from presaved .csv files, you will need to clone this repository in your computer under this file directory:
f"C:/Users/{os.getlogin()}/personal-github/"

2. Refreshing/Adding Data

In order to add or refresh data, you can run the refresh_data() function which can be found in the nfl_singlegame.py file. The only parameter this function needs is the year you are wanting to refresh/add. So the function will look like this to refresh 2025 data:

refresh_data(2025)

3. Running the Code

The nfl_singlegame.py file also holds the run_model() function that will allow you to run the model and output a win probability graph like the one shown below. The inputs that that function needs are the season the game is from, the week of the game(s), the number of seasons of data you want the model to train on, the team of focus or an output of "ALL" to see all of the week's matchups, and a True/False value for whether or not you want the visual displayed. If you are looking to only focus on one team's matchup for the week the abbreviations for each team can be found at the bottom (or in the team.csv file).

To ouput this Chiefs vs. Titans game:

run_model(
 season=2025,
 week=16,
 team_focus="TEN",
 num_season=10,
 visualize=True,
)

kan_v_ten_1221
AFC East AFC North AFC South AFC West
BUF: Buffalo Bills BAL: Baltimore Ravens HOU: Houston Texans DEN: Denver Broncos
MIA: Miami Dolphins CIN: Cincinnati Bengals IND: Indianapolis Colts KAN: Kansas City Chiefs
NWE: New England Patriots CLE: Cleveland Browns JAX: Jacksonville Jaguars LAC: Los Angeles Chargers
NYJ: New York Jets PIT: Pittsburgh Steelers TEN: Tennessee Titans LVR: Las Vegas Raiders
NFC East NFC North NFC South NFC West
DAL: Dallas Cowboys CHI: Chicago Bears ATL: Atlanta Falcons ARI: Arizona Cardinals
NYG: New York Giants DET: Detroit Lions CAR: Carolina Panthers LAR: Los Angeles Rams
PHI: Philadelphia Eagles GNB: Green Bay Packers NOR: New Orleans Saints SEA: Seattle Seahawks
WAS: Washington Commanders MIN: Minnesota Vikings TAM: Tampa Bay Buccaneers SFO: San Francisco 49ers

About

Generate a win probability graph for any NFL matchup.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages