F1 Pit-Stop Prediction

F1 Pit-Stop Prediction

May 2024
machine learning data processing python

Overview

A high-performance binary classification solution built for the Kaggle Playground Series (S6E5) competition, designed to anticipate whether a Formula 1 car will enter the pit lane on the subsequent lap, based on ~440,000 laps of real-time telemetry, tyre degradation, and race context data.

Key Features

  • Severe Class Imbalance Handling: Pit-stop events represent only ~20% of laps; addressed using stratified validation, focal loss, and probability calibration.
  • Telemetry Feature Engineering: Created rolling lap time differentials, tyre age indicators, driver stint duration, safety car flags, and track evolution features.
  • Heterogeneous Model Diversity: Integrated Gradient Boosted Decision Trees (LightGBM, XGBoost, CatBoost) with a deep PyTorch Multi-Layer Perceptron (MLP).
  • Leakage-Free Validation: Out-of-fold target encoding strictly computed inside Stratified 5-Fold Cross Validation loops.
  • Rank Blending & Ensembling: Replaced raw probability averages with rank averaging and seed blending to enhance generalization.

Architecture & Implementation

The data processing pipeline extracts temporal telemetry features and out-of-fold target statistics. Four base learners are trained with 5-fold CV across multiple seeds. Their predictions are normalized via rank transformation and blended through a meta-ensemble weighting scheme.

Results & Performance

Achieved an out-of-fold cross-validation score of 0.9496 ROC-AUC with LightGBM and ensemble blending. In practical terms, the model ranked a pre-pit lap above a normal racing lap in roughly 95% of positive-negative comparisons.

Tech Stack

LightGBM XGBoost CatBoost PyTorch Python Scikit-learn Pandas Kaggle