October 30th, 2014 • Comments Off on American Football Game Analysis
I’ve been coaching American Football for a while now and it is a blast standing on the sideline during game day. The not so “funny” part of coaching however – especially as Defense Coordinator – is the endless hours spend on making up stats of the offensive strategy of the opponent. Time to save some time and let the computer do the work.
I’ve posted about how you could use suricate in a sports data setup past. The following screen shot show the first baby steps (On purpose not the latest and greatest – sry 🙂 ) of analyzing game data using suricate with python pandas and scikit-learn for some clustering. The 3D plot shows Down & Distance vs Run/Pass plays. This is just raw data coming from e.g. here.
The colors of the dots actually have a meaning in such that they represent a clustering of many past plays. The clustering is done not only on Down & Distance but also on factors like field position etc. So a cluster can be seen as a group of plays with similar characteristics for now. These clusters can later be used to identify a upcoming play which is in a similar cluster.
(Click to enlarge)
The output of this python script stores processed data back to the object store of suricate.
One of the new features of suricate is template-able dashboards (not shown in past screenshot). Which basically means you can create custom dashboards with fancy graphics (choose you poison: D3, matplotlib, etc):
(Click to enlarge)
Again some data is left out for simplicity & secrecy 🙂
Making use of the stats
One part is understanding the stats as created in the first part. Secondly acting upon it is more important. With Tablets taking on sidelines, it is time to do the same & take the stats with you on game day. I have a simple web app sitting around in which current ball position is entered and some basic stats are shown.
This little web application does two things:
- Send a AMQP msg with the last play information to a RabbitMQ broker. Based on this new message new stats are calculated and stored back to the game data. This works thanks to suricate’s streaming support.
- Trigger suricate to re-calculate the changes of Run-vs-Pass in an upcoming play.
The webapp is a simple WSGI python application – still the hard work is carried out by suricate. Nevertheless the screenshot below shows the basic concept:
(Click to enlarge)
Categories: Personal, Sports • Tags: American Football, Data Science, Machine Learning, Python • Permalink for this article
December 23rd, 2013 • Comments Off on Live football game analysis
Note: I’m talking about American Football here 🙂
In previous posts I already showed how game statistics can be used to automatically which Wide receiver is the Qb’s favorite on which play, down and field position. Now let’s take this one step further and create a little system (using Suricate) which will make suggestions to a Defense Coordinator.
The following diagram will guide through the steps needed to create such a system:
Live game breakdown (Click to enlarge)
Let’s start at the top. (Step 1) The User of Suricate will start with performing some simple steps. First a bunch of game statistics are uploaded (same as using in this post). Next also a stream is defined. In this case a URI for an AMQP broker (using CloudAMQP – RabbitMQ as a Service) is defined in the service. With this used defined data is provide to the service.
(Step 2) Now we start creating an analytics notebook. Suricate provides an interactive python console via your web browser which can easily be used to explore the data previously uploaded. Python Pandas and scikit-learn are both available within the Suricate service and can be used right away to accomplish this task:
Exploring game statistics (Click to enlarge)
Based on the data we can create a model which describes on which down, on which fieldposition a run or a pass play is performed. We can also store who is the favorite Wide receiver/Running back for those plays (see also). All this information is stored in a JSON data structure and saved using the SDK of Suricate (Step 3).
(Step 4) Now a little external python script needs to be written which grabs relatively ‘live’ game data from e.g. here. This script now simple continuously sends messages to the previously defined RabbitMQ broker. The messages contain the current play, fieldposition and distance togo information.
(Step 5) Now a processing python notebook needs to be written. This is a rather simple python script. It takes the new incoming messages and compares them to the model learned in step 2 & 3. Based on that suggestions can be displayed (Step 6a) – “e.g. watch out for Wes Welker on 3rd and long at own 20y line” or just some percentages for pass or run plays:
Processing notebook (Click to enlarge)
Next the information about the new play can be added to the game statics data file (Step 6b). Once this is done a new model can be created (Step 7) to get the most up to date models all the time.
With this overall system new incoming data is streamed in (continuous analytics), models updated and suggestions for a Defense Coordinator outputted. Disclaimer: some steps describe here are not yet in the github repository of suricate – most namely the continuously running of scripts.
Categories: Personal, Sports • Tags: American Football, Analytics, Data Science, Machine Learning • Permalink for this article
November 17th, 2013 • 1 Comment
Again a little excerpt on stuff you can do with the help of Suricate. Again we’ll look at play-by-play statistics. So no information on which play was performed, but just the outcomes of the plays. Still there is some information you can retrieve from that. Most importantly because it can be done automated without user interaction needed. Just upload the file, press a button and get the results:
Peyton’s favorites (Click to enlarge)
This time you are looking are a cluster analysis of players Peyton passed too in the game of week 1. First cluster represent players passed to on 1,2 & 3 down with up to 6 yards. The second cluster the goto-guys which did go for medium yardage and finally the WOs able to get a bunch of yards on the board.
So with simple scripts (few lines of code – which can be reused) it is possible to abstract information from just play-to-play statistics. I guess mostly important to Defense Coordinators who would love to get some information on the fly with the press of a button 🙂
Categories: Personal, Sports • Tags: American Football, Analytics, Data Science, Machine Learning, Python • Permalink for this article
November 9th, 2013 • 2 Comments
A few line lines of Python code, a big CSV file, some help of Python Pandas, Suricate and about 20 minutes is all it takes to answer the following Question:
Who was Peyton Manning’s favorite receiver during the match-up between Denver and Baltimore in week 1 of the 2013 NFL season?
The answer is simple: Wes Welker 🙂 See the complete graph below…
Peyton’s favorite (Click to enlarge)
Now it would be cool to find a source to stream the data into Suricate (which supports this) and get live up to date charts…but that is for another day.
Categories: Personal, Sports • Tags: American Football, Analytics, Data Science, Python • Permalink for this article
July 20th, 2008 • Comments Off on Training Camps
Gestern gings es also endlich los. Die erste Mannschaft der NFL hat mit seinem Trainings Camp angefangen. Die Washington Redskins legten also los. Lustig was der Tight End Chris Cooley dazu auf sein blog schreibt:
NFL security says the same stuff every year. Drinking and driving is stupid, don’t let crazy people into your home, and for God sakes don’t let anyone talk you into throwing a football game.
Oder noch besser:
We have a bed check every night at 11:00 P.M. Coaches will be roaming the halls and checking everyone’s room. Yes, we are all fifteen years old so I guess that is important. I mean, I’ll check into the locker room around 6:00 A.M. so it’s gonna be pretty hard to go out at night. Bed check?
Das Essen ist natürlich auch der Hit bei so einem Trainingslager:
I decided that I love “Franks Hot Sauce,” I covered my entire meal in it, even carrots.
Der gesamte Artikel findet ihr hier: http://chriscooley47.blogspot.com/2008/07/first-day-is-in-books.html
Categories: Sports • Tags: American Football • Permalink for this article