This project analyzes data from the Ultimate Fighting Championship (UFC) and will eventually build machine learning models to predict the outcomes of future fights. The analysis provided attempted to find trends specifically from the fighter data, and was able to pinpoint how a fighter's Stance affects their chance of winning.
All data was pulled from official UFC statistics
To run this project, you will need to have Python 3.9 or higher installed on your system. You will also need to have Git installed to clone the repository.
- git clone https://github.com/shw-bot/ufc_project
- pip install -r requirements.txt
- Follow the directions above for your desired terminal
- Run Jupyter from the virtual environment
- Open the cloned project folder using Jupyter notebook
- Open ufc_data_cleaning.ipynb and or ufc_fighter_analysis.ipynb
- Click Cell tab and then Run All
Quick note: the website no longer allows webscraping, but the historic data provided in this project, while outdated, can still provide interesting insights
- Open and run fights_to_csv.py
- Note that this can take over 20 minutes
- It will save the data as a csv file, which can be called in later programs in order to expedite the process
- Next, open and run fighters_to_csv.py
- Note this can sometimes take 5 or more minutes
- This data is also saved in a separate csv file
- Open and run cleaning.py in your IDE
- The data will be saved to new csv files, which can then be analyzed even easier
- Alternatively, you can use the ufc_data_cleaning.ipynb notebook for easy visualization of the cleaning process
- Open and run the analysis.py file to generate graphs based on the cleaned data
- Alternatively, you can use the ufc_fighter_analysis.ipynb notebook for easy visualization of the analysis
- Ht.: Height
- Wt.: Weight
- Open Stance: The feet are spaced wider with the front toe toward the opponent and the rear foot at 45 degrees
- Orthodox: Fighters stand with their left foot in front and their right foot in the back. Right hand is connected to chin or head, while left hand is in the lead.
- Southpaw: Fighter has the right hand and the right foot forward, leading with right jabs, and following with a left cross right hook. It is the normal stance for a left-handed boxer.
- Sideways: Any guard in which the front foot is turned inward.
- Switch: Fighter switches between different stances.
- W: Win
- L: Loss
- D: Draw
- Kd: Knock-down rate per 15min fight time
- Str: Number of Significant Strikes
- Td: Number of Take-downs
- Sub: Number of Submissions
- U-DEC: Unanimous decision by judges (if not finished by KO or TKO)
- S-DEC: 3 Judges pick different winners 1:2 (if not finished by KO or TKO)
- M-DEC: 2/3 judges pick a winner, 1 judge says draw (if not finished by KO or TKO)
- SUB: Loser taps out
- KO: Loser is knocked unconscious
- TKO: Technical KO, ref call fight due to severity of strikes/impact
- fights_to_csv.py: Webscraper for historic fight information --> csv
- fighters_to_csv.py: Webscraper for individual fighter information --> csv
- cleaning.py: Cleans fight + fighter data --> csv
- analysis.py: Analysis --> graphs
- ufc_data_cleaning.ipynb: Jupyter Notebook for easy visualization of cleaning
- ufc_fighter_analysis.ipynb: Jupyter Notebook for easy visualization of analysis
- requirements.txt: Required libraries to run the program
The intent of this project is to eventually build a predictive model for UFC Fight outcomes. The analysis provided by the current project gives a great starting point to show what data will be important to consider when training the model.