Machine learning · Backtesting · Formula 1

Predict before knowing. Learn afterward.

I wanted to take my interest in Formula 1 beyond watching races and turn it into a data question: how much can be anticipated using what was actually known before each weekend? F1Predictor estimates the finishing order, learns after the result and repeats that sequence from 1951 through 2026.

Dashboard with verifiable results from the historical F1Predictor backtest
The backtest moves through Formula 1 history race by race and turns every result into a new learning opportunity.
1,156Grands Prix evaluated in chronological sequence
0.436mean Spearman correlation; 95% CI: 0.422–0.450
30.8%of winners identified exactly
62.2%of actual winners inside the predicted top three
Methodological contract

The most important boundary is time.

To reconstruct each prediction, the model works with information available before the first practice session: accumulated ratings, prior form, circuit, forecast and historical reliability. After the Grand Prix it incorporates the result and moves forward.

Before the race

The prediction is built

Inputs include accumulated ratings, prior form, circuit, weather forecast, historical reliability and the signals available in each era.

After the race

The result is revealed

Errors are calculated, Elo and the models are updated, and only then can that race inform the next one.

Structural test

The code preserves the sequence

Tests verify that every round is predicted with the same time boundary and turn the method into a reproducible rule.

Online learning applied to sport: one real race at a time, feedback after the checkered flag and a model that evolves in the same order as history.
Three learning layers

A combination that can correct its own confidence.

Multi-competitor Elo

Global ratings, teammate duels and constructor pace are updated through surprise: observed result minus expected result.

Gradient boosting

Before each race, an expanding-window model is fitted on every previous event and learns nonlinear interactions.

Hedge blend

After each round, multiplicative weights shift confidence toward the layer that ranked that field more accurately.

Separated risks

Additional classifiers estimate retirement by accident and mechanical failure and are evaluated for calibration.

Input signals

Each era contributes a different mix of information.

Circuit

Form and similarity

A numeric fingerprint describes length, corners, downforce, overtaking, elevation, altitude and speed to transfer experience between similar tracks.

Driver and car

Separated capabilities

The driver Elo combines with the internal teammate duel and a constructor pace rating.

Form

Rolling windows

Position, points, grid, retirements and trend use only races that have already happened.

Weather

Pre-race context

Forecast archives are included from 2022 onward; for earlier seasons, historical climatology completes the available context.

Modern data

A reading that gains detail

Pit stops are included from 2011 and OpenF1 strategy and incident signals from 2023.

Reliability

Accident versus mechanical

Separating both types of retirement models more clearly what belongs to the driver and what belongs to the car.

Validation

Beating a competitive reference.

The comparison uses a baseline that ranks drivers by their rolling average finishing position: a simple, solid heuristic available under the same conditions.

MetricF1PredictorBaselineReading
Mean Spearman0.4360.384Paired improvement of +0.051
Exact winner30.8%26.8%+4 percentage points
Significancep = 6.8 × 10⁻³⁸Wilcoxon on race-level differences
Shared podium47.8%—95% CI: 46.2–49.3%
A question opened by the model: circuits with detailed fingerprints were concentrated in different eras, calendars and grid sizes. That result turned the backtest into a tool for discovering new hypotheses, not only producing a ranking.
How it was built

Reconstruct 75 years without letting the future leak backward.

The process orders every Grand Prix by date and reproduces a fixed sequence: build features, train on the available past, predict, save the prediction, reveal the result and update state. That discipline prevents a win, technical improvement or retirement from influencing an estimate that was supposedly made before it happened.

Features are not treated as one static photograph. Driver performance changes race by race; the teammate duel separates part of the car effect; the constructor accumulates its own pace; form uses rolling windows; and the circuit fingerprint transfers experience between similar tracks. When a signal did not yet exist historically, the pipeline uses only the substitute available in that era.

Before every round, gradient boosting is refitted on an expanding window. In parallel, Elo ratings provide a more interpretable view of relative ability. The Hedge blend observes which layer ranked the latest field more accurately and changes its weight for the next race. The system does not choose one permanent winner among models: it learns how much to trust each one as history unfolds.

Freeze the cutoff

Define the moment before the weekend and build every feature from earlier information.

Rank the field

Combine ratings, form, circuit, weather and reliability into a complete finishing-order prediction.

Measure the error

Compare predicted and actual order through ranking, winner, podium and calibration metrics.

Update state

Add the completed race and repeat the exact same contract for the following round.

From model to analysis

Prediction also helps explain why a race is difficult to anticipate.

Saving every forecast before the result makes it possible to inspect much more than the final average. The system can locate eras where the car dominates the signal, circuits where similarity helps, seasons with greater uncertainty and weekends where accidents and reliability disrupt the competitive order. Error stops being one number and becomes material for investigation.

Era comparison

Data that changes through history

Progressive coverage shows how much each modern source adds without pretending it was available in 1951.

Driver reading

Ability versus context

Global Elo, the internal duel and constructor pace expose careers from complementary angles.

Circuits

Transfer between tracks

The fingerprint turns length, corners, altitude, downforce and overtaking into a comparable structure.

Reliability

Two different risks

Separating accident and mechanical failure helps estimate the chance of finishing before positions are ranked.

Calibration

Confidence that can be measured

Probabilities are compared with real frequency to review whether the model is cautious, balanced or overconfident.

Product

Explorable results

Series integrate with Telemetry One so drivers, cars and races can be compared without losing the model version.

What makes the project valuable: it combines temporal engineering, modeling, statistical evaluation and product design in a tool that predicts while generating new questions about the sport.
Capabilities demonstrated

A personal sports analytics lab.

  • Temporal modeling: I built a flow that learns in chronological order and recreates the information conditions of each Grand Prix.
  • Feature engineering: I combined driver, constructor, circuit, weather, form and reliability into signals comparable across 75 years.
  • Rigorous evaluation: I compared the system against a competitive baseline and measured ranking, winner, podium, calibration and uncertainty.
  • Exploratory analysis: the model makes it possible to compare eras, discover patterns and form new questions about performance and context.
  • Reproducible construction: code, tests and results form an inspectable foundation that can be extended and connected to Telemetry One.
Tooling

Built in Python and checked with tests.

The pipeline is written in Python with pandas, NumPy, scikit-learn and SciPy, and draws on Jolpica, OpenF1 and weather archives. I developed it in sessions with Claude Code: all three commits in the repository carry that co-authorship. The time boundary does not rely on trusting the code: a dedicated test checks that no prediction uses information from after its cutoff.

Software and tags

Tools and topics in this article.

Software used or related

  • Python
  • GitHub
  • Claude

Topics

  • F1Predictor
  • Formula 1
  • F1
  • machine learning
  • online learning
  • walk-forward
  • backtest
  • Elo
  • gradient boosting
  • Hedge
  • pandas
  • NumPy
  • scikit-learn
  • SciPy
  • pytest
  • Jolpica
  • OpenF1
  • Claude Code
  • sports prediction
  • sports analytics
  • statistical validation
  • Telemetry One

Related work

Next step

Want to apply this approach to your brand or team?

Book a 30-minute call, review my CV or email me.