Machine Learning · Sports Analytics · Python

Draw Hunter 3000 ⚽

A Random Forest classifier specialised in identifying football draw outcomes across five European leagues — solving one of the hardest prediction problems in sports analytics.

EPL La Liga Bundesliga Serie A Ligue 1
Type
Personal ML Project
Data
1,752 matches · 2023/24 season
Algorithm
Random Forest (200 trees)

Why draws are so hard to predict

In football analytics, draws are the minority outcome — occurring in roughly 26% of matches across European leagues. Standard machine learning models optimise for overall accuracy, which means they learn to predict the majority outcomes (home wins and away wins) while almost completely ignoring draws.

A naive model that simply predicts "Home Win" every time achieves 46% accuracy on EPL data but catches zero draws. Draw Hunter 3000 was built specifically to solve this — treating draw detection as a specialised classification task rather than a general prediction problem.

The core challenge

Out of 1,752 matches across five leagues, only 463 ended in draws (26.4%). Any model that does not specifically account for this class imbalance will learn to ignore draws entirely and still report high accuracy. The solution is to use class balancing, optimise for recall rather than accuracy, and tune the decision threshold specifically for draw detection.

Model Performance

DRAW HUNTER 3000 — FINAL SCORES

0.683
AUC-ROC Score
vs 0.5 random baseline
77%
Draw Recall @ threshold 0.45
Draws correctly identified
37%
Draw Precision @ threshold 0.45
vs 26% random baseline
1,752
Matches in dataset
5 leagues · 2023/24 season

How it was built

1

Data Collection

Loaded historical match data from football-data.co.uk for EPL, La Liga, Bundesliga, Serie A, and Ligue 1 (2023/24 season) using pandas read_csv with direct URLs. Combined into a single dataframe of 1,752 matches.

2

Exploratory Analysis

Analysed draw distribution across leagues (26.4% overall). Identified that draws were the minority class and that standard accuracy metrics would be misleading — confirmed the need for recall-focused evaluation.

3

Feature Engineering

Created new predictive features including half-time goal difference, home and away shot accuracy ratios, and implied draw probability from betting odds (1 / B365D). Selected 21 features covering shots, corners, fouls, cards, and odds.

4

Modelling

Trained and compared three models: Logistic Regression, Random Forest, and Gradient Boosting. Applied class_weight='balanced' to account for the draw minority class. Used stratified train/test split (80/20) to maintain draw proportions.

5

Threshold Optimisation

Generated precision-recall curves across thresholds from 0.30 to 0.60. Selected threshold 0.45 as the optimal balance — catching 77% of draws at 37% precision, nearly 1.5x the random baseline.

6

Model Persistence

Saved the trained model, scaler, and feature list using joblib and JSON for reuse on new match data without retraining.

Why Random Forest won

Three algorithms were trained and evaluated specifically on their ability to detect draws — not just overall accuracy.

Model Draw Recall Draw Precision Overall Accuracy Selected?
Logistic Regression 59% 32% 56% No
Random Forest SELECTED 66% 39% 64% ✅ Yes
Gradient Boosting 10% 29% 70% No

Note on metrics: The recall and precision values shown in this table reflect performance at the default 0.5 decision threshold. After threshold tuning to 0.45 (described in the Methodology section), Random Forest reaches 77 percent recall at 37 percent precision, which is the headline result reported above.

Why Gradient Boosting was rejected

Gradient Boosting achieved 70% overall accuracy — the highest of the three. But it only caught 10% of actual draws. This is the exact failure mode this project was designed to avoid. A model that misses 9 out of 10 draws is useless for draw prediction regardless of its accuracy score.

What predicts a draw?

1

Half-time Goal Difference

The single strongest signal. Matches level at half time are far more likely to end as draws.

0.150
2

Home Shot Accuracy

Clinical home teams are less likely to drop points. Low accuracy signals a potential draw.

0.069
3

Home Win Odds (B365H)

High home win odds signal a competitive match where a draw is plausible.

0.068
4

Away Win Odds (B365A)

Bookmaker odds encode enormous amounts of pre-match information about likely outcomes.

0.064
5

Away Shot Accuracy

Wasteful away teams struggle to win, making draws more likely.

0.056

Technology Stack

Python 3 pandas scikit-learn NumPy Matplotlib joblib Google Colab Random Forest Precision-Recall Analysis AUC-ROC Evaluation Class Imbalance Handling Threshold Optimisation

What I learned building this

This project taught me four lessons that go beyond the textbook view of classification.

1

Accuracy is the wrong metric when classes are imbalanced.

A 70 percent accuracy model that misses 90 percent of the minority class is worse than a 64 percent accuracy model that catches two thirds of it. Choosing the right metric is the entire game.

2

Threshold tuning is underrated.

Most tutorials stop at model selection. Moving the decision threshold from 0.5 to 0.45 lifted recall from 66 percent to 77 percent on the same model. That is free performance most people leave on the table.

3

Domain knowledge improves feature engineering.

Half time goal difference is the single strongest predictor of a draw. That is not something a model can discover on its own. It came from thinking about how football matches actually behave.

4

Compare models on the right axis.

Gradient Boosting "won" on overall accuracy but lost decisively on the metric that mattered. Defining success before training is essential.

Limitations and future work

This is a first iteration of a draw specialised model. Five known limitations and planned improvements:

01

Single season training data

The model was trained on 2023 to 2024 data only. Multi season training would improve generalisation and capture longer term team form patterns.

02

No team specific features yet

The current model relies on match level statistics. Adding team level features (recent form, head to head history, home and away splits) is the highest priority next step.

03

Threshold is fixed across leagues

A future version could adapt the decision threshold per league, since draw rates vary across the five leagues (EPL and Ligue 1 have different draw distributions).

04

No live data integration

The current pipeline runs on historical CSVs. A future version could pull live fixtures and odds through an API for prediction on upcoming matches.

05

No probability calibration

Predicted probabilities are not calibrated. Adding Platt scaling or isotonic regression would make probability estimates more reliable and interpretable.

View the full code on GitHub

The complete notebook, saved model, and data pipeline are available on GitHub.

View on GitHub ↗ Back to Portfolio