TGG Live: How to build your own xG model
Written by Training Ground Guru — December 14, 2022
EXPECTED GOALS (xG) is the most important machine learning model in football.
xG is a measure of the quality of chances created during a match. It allows teams to assess how they are performing over a number of matches. Results in football can be random, so xG tells you if you are on the right track - or not!
Most elite clubs are using some form of xG model - some to monitor performance, some to improve their set-piece routines and some to talk to players about how to get in better shooting positions (or a combination of all three).
Our interactive follow-along How To Build Your Own xG Model Masterclass is with the renowned Professor David Sumpter, who will teach you how the model works. By the end of the session you will be able to create a shot map, showing where all the shots occurred during a match, and rank each shot on the basis of expected goals (xG).
By learning how xG works, you will then be able to move onto other machine learning models more easily.
The Masterclass is on Zoom at 2pm UK time on Tuesday January 24th. It will run for two-and-a-half hours (two-hour session with a 30-minute break in the middle) and include:
The format of the session will be as follows:
- Intro Lecture: What are Expected Goals?
- Follow-along: Shot map and histogram of shot data.
- Follow-along: Fitting models with distance.
- Follow-along: Creating your own xG model.
- Closing Lecture: Advanced xG models and other machine learning models.
By signing up you will learn you to:
- Get your environment set up in Python.
- Instal libraries.
- Fit an xG model to Wyscout data using the Statsmodel in Python.
- Interpret co-efficients in a model.
- Incorporate tracking data into xG models.
As well as being able to take part in the live follow-along session, you will receive a 14-day recording of the session (available from January 25th). We will also give you information on the in-depth Soccermatics Pro course.
A week before the session, we will send you materials that will enable you to hit the ground running on the day, including a video on how to set up to do football data science in Python.
David Sumpter is a Professor at the University of Uppsala in Sweden and the co-founder of the Twelve Football data science consultancy. He has worked with leading football clubs and federations, including Hammarby, Barcelona and England. He had authored a number of books, including Soccermatics (2016), Outnumbered (2018) and The Ten Equations that Rule the World (2020) and had more than 100 scientific articles published, on subjects as diverse as social psychology, machine learning and artificial intelligence. His talks at Google, TedX and The Royal Institution are available online.
David Sumpter: "Everybody knows that machine learning is the way things are going in football analytics. You want to be able to build models that can evaluate whether a pass is a good pass, whether a tackle is a good tackle, or whether a shot is a good shot.
This is what Expected Goals (xG) does and it is the first model coming into machine learning. If you can learn how to build that xG model, then you can learn all the steps into evaluating other metrics.
There were some basic xG models that didn’t involve machine learning right at the start, but now it’s the machine learning models that are used to calculate xG. If you’re working in a club, you want to be able to tune your models to your particular style of play, and you can only do that if you’ve learned how to build the initial model in the first place.
During the Masterclass, I’m going to start by going through exactly what xG is. That is important, because there are so many xG models out there that it is important to get the fundamentals right.
Then we will dive into some coding. We will get your environment set up so you can programme your own model. Then I will go step by step through the code and we will look at how we actually build up that model.
At the end of the two hours you will have your own xG model, which you can feel pleased with and show to their friends!
We will end with a summary, getting this point across about how you can go from Expected Goals to Expected Threat and other more advanced machine learning models.
This course is for professionals, or aspiring professionals, who are already working with data. But it is also for people working in other roles, who have analysts coming to them and who want to be able to ask intelligent questions back."