This repository is outdated
Reworked scraper and prediction model available at new repository Advanced UFC Analyzer
This project uses machine learning to predict the winner between 2 UFC fighters using historical fight data and fighter statistics. Using a supervised learning approach, the model is built on a neural network architecture that processes attributes of fighters, including height, weight, age, striking, grappling statistics and etc...
By analyzing patterns and relationships in the historical matchups, it gives greater weight to features of fighters that have been more apparent in past winners.
We do some preprocessing on the data to make sure the quality of it is as good and not overfitted, then duplicate the fight data, swapping fighter1
for fighter2
, balancing out the dataset, avoiding bias from the model so it focuses on the comparative features instead of the order of the fighters.
When the data is ready, we train the model, we save it in the models/
directory so that we can reuse it without training the model every time a prediction is to be made.
For the dataset, I used jansen88's UFC data scraper, follow the instructions there.
Data Handling:
Machine Learning Model:
models/
and load it from therePrediction:
API:
UI:
Install the required Python packages from requirements.txt
found in the root folder.
pip install -r requirements.txt
Clone the repository
git clone https://github.com/markbakos/ufc-predictor.git
cd ufc-predictor
Install dependencies for frontend
cd client
npm install
Start the development server
Frontend:
cd client
npm run dev
Backend:
# Make sure you are in root folder
source venv/bin/activate
uvicorn app.server:app
Place your dataset into the app/data/
folder. Make sure it is called complete_ufc_data.csv
Navigate to http://localhost:5173 or the address provided in your terminal to use the app.
The model currently shows accuracy of around ~66.5% for blind data.
The current model only compares the fighters' physical and fighting statistics, it still lacks many features, including:
(These might not improve the accuracy of the model, only a theory)
Feel free to fork this repository, make changes, and submit a pull request.
For any inquiries, feel free to reach out:
Email: [email protected]
GitHub: markbakos