In this project, we scrape data from ufcstats.com and apply machine learning techniques to this data to make UFC fight predictions (winner and method). The predictor is available here.
Clone this repository. Open a terminal and cd to repo.
Make sure Python3.9 is installed on your computer. To install all requirements you can do:
python -m pip install --upgrade pip
pip install -r requirements.txtThe dataset is already included in the repository so there is no need to scrape the stats and build the dataframe from scratch, but you can do so from the scripts 1-build_ufc_fights_reported_doubled.py, and 2-build_ufc_fights_reported_doubled_derived.py (running one after the other should take about an hour).
After every UFC event, the dataset and model will need to be rebuilt. You can do this by running update_and_rebuild_model.py.
This rebuilds the machine learning model to incorporate the updated data. It also scrapes vegas odds for upcoming events from here, makes predictions for upcoming events, and updates the json files used to populate tables for the website.
- Now, to make sure the current build is working, locally serve the index.html file in the root directory of the repository. You can do this by running the following commands:
cd ..
python3 -m http.server 8000Now go to chrome and type localhost:8000 into the address bar. This opens the updated version of the website.