Skip to content

bedigambar/F1-Predictor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏎️ F1 AI Race Predictor

An advanced machine learning-powered dashboard for predicting Formula 1 race outcomes, qualifying positions, and safety car probabilities.

F1 AI Predictor Python XGBoost

🎯 Features

  • Qualifying Position Prediction: Predict grid positions based on practice performance and driver form
  • Race Result Prediction: Forecast final race positions using qualifying results and weather conditions
  • Safety Car Probability: Calculate the likelihood of safety car deployment
  • Grid Comparison Mode: Compare multiple drivers side-by-side
  • Interactive Visualizations: Position progression charts and feature importance analysis
  • Historical Statistics: Circuit-specific data and trends

🚫 Deployment Note

This application is not currently deployed on Streamlit Cloud due to resource limitations with the heavy ML dependencies (XGBoost, FastF1, scikit-learn) and large model files.

To run the app, please follow the local installation instructions below. The setup is straightforward and takes only a few minutes. You can also check out the Demo Video below to check how the app looks and works like!

🎥 Demo Video

Check out the application in action:

f1-predictor-cursorful-video-1764651825152.mp4

📊 Model Performance

  • Qualifying MAE: 3.55 positions
  • Race MAE: 3.29 positions
  • Training Data: 839 records from 2022-2024 F1 seasons (42 races, 21 circuits)

🛠️ Tech Stack

  • Frontend: Streamlit
  • ML Models: XGBoost (Regressor & Classifier)
  • Data Processing: Pandas, NumPy
  • Visualization: Plotly
  • Data Source: FastF1 API

📦 Installation

Local Setup

  1. Clone the repository:
git clone https://github.com/yourusername/f1-predictor.git
cd f1-predictor
  1. Install dependencies:
pip install -r requirements.txt
  1. Run the dashboard:
streamlit run dashboard/app.py

Data Collection & Model Training (Optional)

If you want to retrain the models with fresh data:

# Fetch F1 data
python scripts/fetch_data.py

# Preprocess data
python scripts/preprocess.py

# Train models
python src/train.py

📁 Project Structure

F1 Project/
├── dashboard/
│   └── app.py              # Streamlit dashboard
├── data/
│   └── processed/          # Processed training data
├── models/                 # Trained ML models (.pkl files)
├── notebooks/
│   └── model_training.ipynb # Interactive training notebook
├── scripts/
│   ├── fetch_data.py       # Data collection from FastF1
│   └── preprocess.py       # Data preprocessing
├── src/
│   └── train.py            # Model training script
├── requirements.txt        # Python dependencies
└── README.md

🎨 Dashboard Preview

The dashboard features:

  • Premium F1-themed UI with custom CSS styling
  • Responsive design for all screen sizes
  • Real-time predictions with interactive controls
  • Data-driven insights with historical statistics

⚠️ Disclaimer

These predictions are generated by AI models trained on limited historical data (2022-2024 seasons). Real-world F1 racing involves many unpredictable variables (crashes, mechanical failures, strategy errors) that cannot be fully accounted for. Treat these results as estimates rather than certainties.

📝 License & Attribution

F1 AI Race Predictor is released under the MIT License — © 2026 bedigambar.

You're welcome to use, modify and build on this code, but you must keep the copyright notice and license intact (i.e. give credit). If you ship something based on F1 AI Race Predictor, a shout-out and a link back to this repo is hugely appreciated. 🙏

🤝 Contributing

Contributions are welcome! Feel free to:

  • Report bugs
  • Suggest new features
  • Submit pull requests

👨‍💻 Author

Created with ❤️ for F1 fans and data enthusiasts


Note: This is a fan project and is not affiliated with Formula 1, FIA, or any F1 teams.

About

An advanced machine learning-powered dashboard for predicting Formula 1 race outcomes, qualifying positions, and safety car probabilities.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors