← Projects

F1 driver comparison simulator

A pairwise Formula One driver comparison simulation tool built in Python.

Mar 27, 2026data science
Pythonpandasscikit-learnNumPy

GitHub

Background

Every F1 season produces the same argument. Is Verstappen the best driver on the grid, or does he have the best car? Put Hamilton in that Red Bull and what happens? Who is the GOAT?

The argument never resolves because the data can’t settle it. A finishing position is the product of the driver, the car, the pit stops, the strategy, and everything else in the race.

This is what this project tries to do - settles the argument once and for all.

Methodology

Within-race standardization over absolute times. This is what made everything else possible. Circuit, era and weather effects hit every driver in a race equally, so they cancel in the difference.

Random forests over linear regression. Small feature set, but the relationships aren’t linear: qualifying advantage doesn’t convert to points at a constant rate. Random forests handle that without distributional assumptions and give interpretable importances. I used permutation importance rather than the built-in impurity version, which is biased toward high-cardinality features.

Independent Gaussian laps. Every lap is drawn independently, so the model has no concept of tyre degradation, fuel burn-off, safety cars or pit stops. I took it because modeling stint-level dynamics are track, or even race-specific, and it would be an entirely different project.

Results

Across 2018–2022, the model picked the stronger driver correctly in 70.4% of 19,570 pairwise comparisons over 103 races, against a 50% coin-flip baseline.

Season Pairs Accuracy
2018 3,990 71.15%
2019 3,990 69.67%
2020 3,230 68.58%
2021 4,180 73.06%
2022 4,180 69.21%

And, for the one we all care about - our model predicts a 51.7% probability Lewis Hamilton wins over Max Verstappen at Yas Marina Circuit, Abu Dhabi 2021.

Looking back

One thing I would do is further splitting train and test data within regulation eras. Beyond the scope of this project, I would like to model lap-to-lap dependence so tyre and fuel effects show up, which would be crucial for modeling a real race.