A Random Forest classifier specialised in identifying football draw outcomes across five European leagues — solving one of the hardest prediction problems in sports analytics.
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.
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.
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.
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.
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.
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.
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.
Saved the trained model, scaler, and feature list using joblib and JSON for reuse on new match data without retraining.
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.
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.
The single strongest signal. Matches level at half time are far more likely to end as draws.
Clinical home teams are less likely to drop points. Low accuracy signals a potential draw.
High home win odds signal a competitive match where a draw is plausible.
Bookmaker odds encode enormous amounts of pre-match information about likely outcomes.
Wasteful away teams struggle to win, making draws more likely.
This project taught me four lessons that go beyond the textbook view of classification.
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.
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.
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.
Gradient Boosting "won" on overall accuracy but lost decisively on the metric that mattered. Defining success before training is essential.
This is a first iteration of a draw specialised model. Five known limitations and planned improvements:
The model was trained on 2023 to 2024 data only. Multi season training would improve generalisation and capture longer term team form patterns.
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.
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).
The current pipeline runs on historical CSVs. A future version could pull live fixtures and odds through an API for prediction on upcoming matches.
Predicted probabilities are not calibrated. Adding Platt scaling or isotonic regression would make probability estimates more reliable and interpretable.
The complete notebook, saved model, and data pipeline are available on GitHub.
View on GitHub ↗ Back to Portfolio