villekuosmanen / F1Predict

GNU Lesser General Public License v3.0
37 stars 12 forks source link

F1Predict

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.

Running the project

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:

Example user_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).

Package structure

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.

How to contribute

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

Credits

Qualifying model

Race model

Special thanks