Predicting the 2022 World Cup with Machine Learning (without code)

Cameron Welland
6 min readNov 18, 2022

--

The World Cup begins with the group stage with the 32 qualifying national teams being split into eight groups of four teams. Each team plays the 3 teams in their respective groups once, earning 3 points for winning, and 1 for drawing. The top two teams from each group advance to the knockout stage.

The knockout stages are elimination games, there are no draws, games will go to extra time and penalty shootouts if the scores are level. The rounds of the knockout stage are The Round of 16, The Quarter Finals, The Semi Finals, and The Final. All a team has to do to win The World Cup is win 4 games in a row. Easier said than done.

The Fuel (Dataset)

I’m training the machine learning model using a dataset containing 23,000 international football games going back to 1993. Each game has information about who’s playing and what their FIFA ranking was, where it’s being played, what tournament it’s in, and most importantly what the result was.

A classification machine learning model predicts the class label (dependent variable) of a given datapoint. It trains on a dataset and learns how the features (independent variables) affect the class label. You give the model features and it tells you what it thinks the class will be, simple right?.

In our case, the features we are giving the model are the details about the upcoming group stage games, like who’s playing, what their FIFA ranking is etc. The class we are predicting is the home team result; Win, lose or draw.

Excerpt from the training dataset
Excerpt from the training dataset

The Technical Part

I used the AI & Analytics Engine to build my ML models, because it doesn’t require any coding. The first step was to upload the training data, which I did by uploading in CSV format because it’s easy, although files can also be imported from a database. Next is creating the app, which is mostly specifying that it’s a classification problem and that we’re trying to predict the result column.

Then it’s time to create the models. I trained multiple models which use different classification algorithms. Each algorithm has different methods of predicting the class label, and therefore have different levels of accuracy. Some of the algorithms I tried included K-nearest neighbors, Random Forest, and Logistic Regression. However the best performing model used the LightGBM algorithm which is based on decision trees, so I proceeded with that model.

Machine learning process
Machine Learning Process

It’s important to understand how each model is decides it’s prediction, The Engine helps you understand why a trained model performs as it does, under the feature importance tab. It displays a summary of which features in the training data affect the predicted class the most. For the home team to win, the difference between the FIFA rankings is by far the most important variable. There does seem to be a home team advantage, because the neutral location variable is second most important.

Feature Importance in The Engine
Feature Importance in The Engine

The Evaluation

The model uses 80% of the training data to learn, but saves 20% in order to evaluate itself. We can see this in the displayed confusion matrix. Put simply the confusion matrix visualizes the models performance by comparing the predicted and actual class. The model is most accurate when predicting the label “win” and tends to predict that class most often. The model also rarely picks a draw which can be seen in the group stage predictions.

Multiclass Confusion Matrix in The Engine
Multiclass Confusion Matrix in The Engine

World Cup Group Stage Predictions

Now for the good stuff. With the model ready, it was time to upload the data for the group stages to get our predictions for each game. By uploading a CSV for the upcoming games in the same data schema as the training data (the same format of columns for the unacquainted). The model gives a probability of each given class, and chooses the most likely outcome. This means we can calculate the expected points (XPTS), with the formula:

XPTS = P(Win) * 3 + P(Draw).

These are the results:

Group Stage Predictions
Group Stage Predictions

Big surprise, many of the highest ranked teams are projected to win all of their group stage games, as the FIFA ranking difference is the most predictive feature. Although there was a few exceptions. Some notable upsets include USA (ranked 16th) defeating England (5), Canada (41) defeating Morocco (22), and Germany (11) defeating Spain (7). Finally, we have to mention that my own country, Australia (38th) was predicted to defeat Tunisia (30th), although it wouldn’t be enough to make it past the group stage :(

France has the highest XPTS, meaning that it is strongest team in comparison to its group, closely followed by Brazil and Belgium.

World Cup Knockout Stage Predictions

Now the model has predicted which teams move onto the first round of the knockout stage. I created the test data of games according to the predictions from the previous (group) stage, and repeated the process for the quarter finals, semi finals, and *drumroll* the final.

Batch Predictions in The Engine
Batch Predictions in The Engine

Round of 16:

The USA upset the higher ranked Netherlands who topped group A without losing a game. Serbia, the lowest ranked team remaining, were also able to upset Uruguay. Argentina, Brazil, England, France and Belgium were all favourites and progressed, while Croatia was able to defeat similarly ranked Germany.

Quarter Finals:

USA’s streak of luck ended, falling short of 3rd ranked Argentina. The top two ranked teams, Brazil and Belgium were able to defeat Croatia and Serbia respectively. Finally, cross-channel rivals England and France were ranked 4th and 5th respectively, however the French progressed to the Semi finals.

Semi Finals and Final:

The four teams consisted of teams ranked in the top five by FIFA ranking, reiterating how strongly the model considers that feature. Predictably, first ranked Brazil and second ranked Belgium, progressed to the final, where Brazil would be predicted to win.

Knockout stage predictions

So that’s it. With the given data, the Engine predicts Brazil wins the 2022 FIFA World Cup. However sports are notoriously hard to predict, with a million different variables at play. I’d love to improve the model by adding more variables to the training data and making a more sophisticated model.

This post is part of my ongoing series of blog articles on using machine
learning algorithms in the AI & Analytics Engine to predict sport events
and results.

Predicting the 2022 World Cup with Machine Learning
Which nation will win the worlds largest sporting event?

Predicting the 2023 NBA MVP with Machine learning
Who will claim MVP honors in one of the tighest races in memory?

Check them out if you're interested! And if you have any requests, let me
know, I'm available on
linkedin.

--

--

No responses yet