Loading predictions…
Loading predictions…
A fully automated ML pipeline that turns qualifying session data into race finishing position predictions — from raw telemetry to a live dashboard, end to end in minutes.
Raw session data is pulled from the FastF1 library after each qualifying session — lap times, sector splits, tyre compounds, and session metadata. Everything lands in S3 as Parquet files in the bronze layer, preserving the original schema.
Bronze data is normalised into a consistent schema: driver IDs standardised, session types unified, and tables joined across qualifying and practice sessions. This layer is safe for downstream analytics without touching raw files.
DuckDB SQL transforms the silver layer into a flat feature table per driver per event. Key signals are extracted: qualifying position, absolute Q1/Q2/Q3 times, gap to pole, the spread of the top-10 gaps (circuit competitiveness proxy), and practice best/median lap times.
An XGBoost regressor is trained to predict finishing position. Leave-One-Season-Out (LOSO) cross-validation ensures no season leaks into its own validation fold. The trained model is exported to ONNX format alongside a sklearn preprocessor, both versioned in S3.
After qualifying, a Fargate container loads the latest ONNX model from S3, runs predictions for all 20 drivers, and writes ranked results to DynamoDB. Predictions are available within minutes of qualifying ending.
A Lambda function aggregates predictions, model metrics, and historical accuracy from DynamoDB and serves them via a single API endpoint. The Next.js dashboard fetches fresh data on every page load — no stale caches.
The model is an XGBoost regressor trained to predict finishing position as a continuous value. Regression — rather than a ranking objective — proved more stable across seasons with varying grid sizes and regulation changes.
Training uses Leave-One-Season-Out (LOSO) cross-validation: each fold holds out an entire season for validation while training on all others. This prevents any season's patterns from leaking into its own evaluation and better simulates predicting a race you haven't seen yet.
The trained model is exported to ONNX format, enabling fast, dependency-light inference at runtime. A separate sklearn preprocessor handles feature scaling and is versioned alongside the model in S3.
All features come from qualifying and practice sessions — no race-day data.
qualifying_position92Final classified grid position from qualifying
gap_to_pole78Time gap from the driver's best Q lap to pole position
q3_seconds71Absolute Q3 lap time (null for drivers eliminated in Q1/Q2)
top10_gap_spread58Range of gaps within the top 10 — proxy for circuit competitiveness
practice_best_lap_time_seconds45Best single lap across all practice sessions
practice_median_lap_time_seconds38Median practice lap — smooths out traffic and outlier laps
q1_seconds / q2_seconds30Absolute lap times from earlier qualifying rounds
Relative importance score (0–100) derived from XGBoost feature importance.
Every feature set below was evaluated and cut — either it hurt precision or added fragility without measurable gain. The baseline (87.3%) remains the bar to beat.
The full pipeline runs on AWS with no manual intervention required during a race weekend. An EventBridge cron triggers every two hours on Friday–Sunday. A Step Functions state machine orchestrates ingestion → training → inference, with each stage running as an isolated Fargate container.