Giter VIP home page Giter VIP logo

romanlutz / nflplayprediction Goto Github PK

View Code? Open in Web Editor NEW
35.0 9.0 10.0 8.48 MB

Based on NFL game data, we want to predict the success of a play. This can be used to insert different strategies before the play is called to determine the success probability.

Python 1.15% OpenEdge ABL 98.85%
nfl football machine-learning sportsanalytics sports-science national-football-league prediction

nflplayprediction's Introduction

Based on the statistics of all NFL seasons from 2009 to present, we'll try to predict the outcome of a play based on the situation and under the assumption of a certain play. This way, one could plug in every possible play and predict the best play to choose.
Possible applications include participation in NFL call the play or even NFL Offensive Coordinators could use our prediction tool to find out what kind of play is the most promising.

We use the nflgame API that gets its data directly from NFL.com. The format is as follows:
(DEN, DEN 22, Q4, 3 and 8) (4:42) (Shotgun) P.Manning pass short left to D.Thomas for 78 yards, TOUCHDOWN. Penalty on BAL-E.Dumervil, Defensive Offside, declined.
However, there are lots of special cases and inconsistencies that we're removing or adjusting to get structured data.

Features
=========
* Team
* Opponent
* Quarter
* Time
* Field position
* Down
* Yards to go
* Shotgun formation (0/1)
* Pass (0/1)
* Side
  -> Pass: left / middle / right
  -> Run: left end / left tackle / left guard / middle / right guard / right tackle / right end
* Pass length (short / deep)
* QB Run (0/1)

After filtering out irrelevant plays (special teams, "No Play"), we extracted information from the strings about the play. The labels show the success of the play, i.e. TD or not, how many yards, first down or not, possibly a combination of these (as a real value).

Our Approach:
Feature extraction: What features do we use? What plays are ignored?
Prediction: Probability of success? What's a success? We use a variety of different measures for that.

Machine Learning methods:
Classification (Success / Fail): SVM, Nearest Neighbors, Decision Trees, Logistic Regression, Neural Nets
Regression (Yards): SVR, Neural Nets, Linear Regression
Dimensionality reduction: PCA
Prediction: Play with highest probability (or score?) of success
Evaluation: k-fold cross validation

Installation:
In order to use our NFL Play Prediction, you will need to install the nflgame API with the following command:
sudo pip install nflgame
Another requirement is the scikit-learn package for Machine Learning operations:
sudo pip install scikit-learn
If you already have numpy and scipy installed, use the -U option in the previous command.
If you want to use the Neural Network prediction, you need to run this first:
easy_install pybrain

nflplayprediction's People

Contributors

romanlutz avatar valentin012 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

nflplayprediction's Issues

Feature extraction matching issue

When using extract_features(2013, 2014) I ran into the following error: (it won't happen for 2014, 2014!)

"NFLPlayPrediction/features.py", line 118, in extract_features
match = rematch.group(0)
AttributeError: 'NoneType' object has no attribute 'group'

I'm not really sure why it happens, but I'll look into it. Please do the same if you can!

Feature Extraction: filtering errors

I just discovered possible filtering errors. When using the DictVectorizer to convert categorical features (e.g. opponent=DEN) to numbers (using one-hot encoding this could result in 32 binary features indicating whether the opponent is a certain team or not), the following were shown as values of certain features: (I'll mark the correct ones)
35: u'passlen=deep', <--- correct
36: u'passlen=intended',
37: u'passlen=left',
38: u'passlen=right',
39: u'passlen=short', <--- correct
...
43: u'side=41',
44: u'side=48',
45: u'side=EJ',
46: u'side=QB',
47: u'side=for',
48: u'side=kicks',
49: u'side=kneels,',
50: u'side=left', <--- correct
51: 'side=middle', <--- correct, but somehow not u'side?
52: u'side=right' <--- correct
53: u'side=sacked',
54: u'side=snap',
55: u'side=the',
56: u'side=to'

There's no immediate hurry to fix this, but please take a look at it whenever possible. I'll look into it as well.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.