A project for predicting F1 qualifying results using statistical analysis, machine learning and a Monte Carlo simulation. For visualising the predictions, see F1PredictWeb.
The project uses the Ergast F1 API for statistical data.
In order to run the prediction generator you first need to set up a MySQL database where a local copy of the F1 data will be stored. You will also need Python 3 and Pip. These instructions should work in Linux and MacOS computers (unfortunately there may be problems with installing certain Python packages in Windows).
The instructions are as follows:
user-variables.txt
inside F1Predict (see example below). Change the values of each field to match the values in your local database.python3 -m venv <environment name>
, and . venv/bin/activate
pip install -r requirements.txt
to install dependenciespython3 setup.py sdist bdist_wheel
and then install the built package with pip install -e .
sh dbUpdater.sh
. This adds most recent data to your local database and runs the program, generating predictions to the output folder specified in user-variables.txtuser_variables.txt
file:db_username=username
db_password=password
db_database=f1db
predictions_output_folder=../F1PredictWeb/src/public/data/
The keys (left side of equation) must remain constant, but the values (right-hand side) can be changed to values you prefer. Bu using the example output folder, the predictions are automatically saved to F1ProjectWeb's data folder (if the repositories share the same root folder).
The f1predict
folder contains the models, and utility and common code for running them. It is structured in classes and runnable functions. This package is designed to be as self-contained as possible, and as such it needs to be locally installed in order to use the scripts and notebooks below.
The scripts
folder contains scripts, each corresponding to a particular workflow. The shell script dbUpdater.sh
runs them to generate qualifying an (pre-quali) race predictions, as well as generating all models for most recent data. The script runRaceModel.py
generates post-quali predictions for a particular grid.
The notebooks
folder contains Jupyter Notebooks, which are mainly used for evaluating the models, and investigating the data.
If you're interested in contributing to the project, feel free to open an issue about the feature or improvement you would like to add. If an issue for it already exists, comment under it to express your interest. If you don't have a specific issue in mind but would like to contribute, you can open a new issue saying you'd like to contribute