Back to projects

Academic project · B.Sc. thesis · 2023

Pit-stop decision modelling

Can historical race data help model when a Formula 1 team will pit and which tyres it will choose?

I collected and prepared race data, compared machine-learning approaches, and examined their predictions and limitations. My thesis was graded 5.6/6. You can read my intermediate report and view my thesis defence slides below.

The prediction task

I modelled two decisions: whether a car will pit, and which tyre compound it will use if it does. For the sequence-based model, I used previous laps to predict a stop on the following lap.

I collected lap-by-lap race data using FastF1 and prepared inputs such as tyre age, stint, lap time, track status and the gap to other drivers. I used historical team decisions as the target labels.

Models and evaluation

I compared random forests, neural networks and recurrent neural networks. I trained the models on races from 2019–2022 and reserved 2023 for testing. I separated the training and validation data before preprocessing to avoid information leaking between them.

Pit stops are rare compared with laps without a stop. I examined precision, recall and F1 scores rather than relying on overall accuracy, alongside charts showing predicted pit-stop probabilities throughout a race and explanations of individual predictions.

Results and limitations

Predicted pit-stop probabilities over Lance Stroll's 2023 Spanish Grand Prix. Red vertical lines mark the prediction targets one lap before actual stops; the upper bars show tyre compounds.
A figure from my thesis: Lance Stroll, Spain 2023. Predictions use the preceding lap; red markers show the target one lap before each actual pit stop.

In this example, the random-forest probabilities increased during a stint and fell after a stop, with a slower increase on hard tyres. I identified tyre age, lap number and stint among the important inputs. My models still produced many false positive pit-stop predictions.

My models learned to imitate historical decisions, which does not establish an optimal strategy. They captured relationships in race data but still struggled to pinpoint the stopping lap. I therefore treated their probabilities as signals to examine rather than proof that a stop was the best decision.

Report and presentation