Inspiration

As a group of avid football fans, we're all interested in finding out in how we can improve, and how likely we are to score! However, sometimes the best option isn't always the most obvious, and we wanted to uncover the truth behind that.

We wanted to create a tool that would be able to help not just hobbyists like us but also coaches and small teams without the massive budgets of higher-league football teams.

What it does

We have built a website that allows a user to place all 22 players on the football pitch, select which player to control, and from there they are presented with a list of the most optimal actions they can take, to maximise the probability of scoring a goal in that same play!

How we built it

We used a series of machine learning models, to predict various footballing statistics, most importantly our "possession value". This is the probability, that given the exact state of play submitted, the attacking team is to score a goal in the same passage of play. This was largely done in a Python Flask backend with Scikitlearn and PyTorch, using a mixture of neural networks (with mixed attention layers), logistic, and linear regression models. We built our front end using Vite + React, which allows the user to select the exact position of each player on the pitch, and also gives the user the chance to enter their own prompt, using an LLM, to place all the players for them!

Challenges we ran into

Sadly, the model for our possession value proved to be a complex issue, and we had to go through multiple different avenues of thinking, constantly adapting and retraining until we managed to find a viable solution that accurately represented different positions on the pitch. We had to figure out the best way to engineer our NNs and features to get the best most accurate model which does not over or under-fit.

Accomplishments that we're proud of

In the process of creating our possession value model, we created a complicated NN with cross-attention, that was able to accurately predict the probability of scoring, and not only that, we were able to create several more models to predict other statistics like xG and possession value, massively broadening all of our horizons. We also managed to successfully implement an LLM in our front-end, allowing the user to submit their game situations with ease!

What we learned

We managed to increase our ML and data engineering knowledge greatly throughout this project, as these datasets were often very sparse in terms of a goal being scored at the end of a passage of play, realising sometimes simpler was better.

What's next for xHack

In the near future, we plan to implement image processing, where we take in a picture of a football play, and convert this onto our UI, so coaches, hobbyists, or the average football fan can take a photo of one of their most memorable moments, whether it be good or bad, and find out what couldv've been if things were done differently!

Share this project:

Updates