Welcome to our Formula 1 Predictor project! This project was made for the Applied Machine Learning course at the University of Groningen, part of the Artificial Intelligence Bachelor's program.
The goal is to predict the outcome of Formula 1 races leveraging machine learning.
Currently, our API is not publicly available, but you can still run the code locally to train and test our diverse selection of models.
All changeable parameters are stored in the config.py file, so you can easily adjust them to your needs.
[WARNING] This project is built with Python 3.9. Make sure you have this version installed on your machine. If you are using a different version, you may encounter compatibility issues.
- Clone this repository to your local machine:
git clone https://github.com/1-million-weed/Applied-ML-GROUP1.git cd Applied-ML-GROUP1 - Set up a virtual environment (our team used a mix between
pipenvandvenv):python -m venv venv source venv/bin/activate pip install -r requirements.txt
- If you prefer using
pipenv, you can install the dependencies with:Ensure you are in the directory where thepip install pipenv pipenv install
Pipfileis located when running this. - To run just the API server, execute:
Then head over to 'http://localhost:8000/docs' to access the Swagger UI and test the API endpoints.
python main.py
- To run the Streamlit application, execute:
Then head over to 'http://localhost:8501' to acces our streamlit api demo.
streamlit run main.py
Everything in this project is configurable through the config.py file. This includes:
- The
modelto be used for predictions - Dataset acquisition
- Whether to acquire new data or use existing data
- Whether to
preprocessthe data - Whether to
generatenew features from raw data - Training and testing data
split
- Model training
- Whether to
traina new model or use an existing one Tensorboardlogging
- Whether to
- Model evaluation
- Whether to
evaluatethe model on the test set - Whether to show the evaluation
plots
- Whether to
- Model inference
- Whether to run
inferenceon the model - Whether to activate the
API server - Whether to run the
Streamlitapplication
- Whether to run
- Logging
- The level of logging (
DEBUG,INFO,WARNING,ERROR,CRITICAL)
- The level of logging (
The API provides several endpoints to interact with the model:
-
GET /: API Health check
-
GET /meetings: List of all meetings from the current season
-
GET /meetings/{meeting_id}/max-laps: List the maximum amount of laps in a race
-
GET /docs: Swagger UI documentation
-
POST /predict: Predict the outcome
├───data # Stores raw .csv files
├───models # Stores .pkl files for trained models
├───experimental # Contains experimental .ipynbs & .py
├───f1_predictor
│ ├───app # Contains the Streamlit app
│ ├───data # stores processed .csv files
│ ├───data_acquisition # For acquiring data from the FastF1 API for 2025 data
│ ├───features # For scripts and logic for feature engineering
│ ├───ml # Contains the machine learning logic (pipelines & managers)
│ └───models # For model creation, not storing .pkl
├───reports # For outputs and visualisations
├───tests
│ ├───data
│ ├───features
│ └───models
├───.dockerignore
├───.gitignore
├───.pre-commit-config.yaml
├───config.py
├───Dockerfile
├───main.py
├───mylogger.py
├───train_model.py
├───Pipfile
├───Pipfile.lock
├───README.md
├───requirements.txt