A robust, machine learning-powered web application that predicts whether a Formula 1 driver will pit on the next lap based on live race telemetry.
- Advanced ML Pipeline: Built using an XGBoost Classifier engineered specifically for time-series race data.
- Data Leakage Prevention: Trained using
GroupShuffleSpliton race events to ensure the model generalizes perfectly to entirely new and unseen races. - Handling Class Imbalance: Predicts rare pit stop events with high recall (85%) by explicitly penalizing false negatives via
scale_pos_weight. - Rolling Time-Series Features: Uses rolling lap time averages and lap time gradients to evaluate a driver's true degradation curve.
- Sleek Web Interface: Features a premium, dark-mode, F1-styled Streamlit application.
- Clone the repository.
- Install the requirements:
pip install -r requirements.txt
- Run the Streamlit web application:
streamlit run app.py
- Algorithm: XGBoost
- Feature Engineering: Pandas grouping (3-lap rolling averages, LapTime gradients).
- Hyperparameter Optimization: Randomized Grid Search (
n_estimators,max_depth,learning_rate).

