Skip to main content

A Python implementation of NFL Win Probability (WP)

Project description

Build Status Documentation Status

Estimate Win Probability (WP) for plays in NFL games:

>>> import pandas as pd
>>> from nflwin.model import WPModel
>>> standard_model = WPModel.load_model()
>>> plays = pd.DataFrame({
... "quarter": ["Q1", "Q2", "Q4"],
... "seconds_elapsed": [0, 0, 600],
... "offense_team": ["NYJ", "NYJ", "NE"],
... "yardline": [-20, 20, 35],
... "down": [1, 3, 3],
... "yards_to_go": [10, 2, 10],
... "home_team": ["NYJ", "NYJ", "NYJ"],
... "away_team": ["NE", "NE", "NE"],
... "curr_home_score": [0, 0, 21],
... "curr_away_score": [0, 0, 10]
... })
>>> standard_model.predict_wp(plays)
array([ 0.58300397,  0.64321796,  0.18195466])

For full documentation, including information about methods and accuracy, click here.

License

MIT. See license file.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page