Elo rating system
The Elo rating system is a method for calculating the relative skill levels of players in zero-sum games. It has been mostly used in chess. But many have applied the same algorithm in other competitive games such as soccer, basketball and scrabble.
In this article, we will predict the winner of this UFC fight based on Elo ratings using Python.
Collecting the data
Based on the Elo rating system, we need to collect data for all fights related to Conor and Cowboy in the past. I scraped the historical data from sherdog.com.
The process starts from the page with the fight history of Conor. All the fight information related to him in the past was gathered. Also, for each of his opponents, all the fight information related to them were gathered in a similar manner.
Given that one of the opponents of Conor (Nate Diaz) fought with Cowboy, this data has included information related to Cowboy too. In the end, we will have data for Conor’s opponents, Cowboy’s opponents, their opponents’ opponents and so on.
While MMA has been a sport for decades, it would take very long to scrape the entire dataset. Therefore, I stopped the process when the data reached 36,503 fighters and 93,778 fights. This should be enough data for our purpose.
The data at the end looks like below:
Applying the Elo algorithm
The details of the Elo algorithm can be found here.
In short, the algorithm updates the rating of a fighter based on each new match. The simple mathematical formula below describes the procedure:
The most important parameter to tune is K. It decides how many rating points are added or subtracted after a match. Higher values of K would mean more volatile ratings.
To show an example, let’s assume two fighters A and B.
Current Rating of Fighter A = 1500
Current Rating of Fighter B = 1500
Assume a new match between them ends with A as the winner. We need to update the ratings of these two fighters accordingly.
When K = 10:
New Rating of Fighter A = 1500 + 10*(1–0.5) = 1505
New Rating of Fighter B = 1500 + 10*(0–0.5) = 1495
When K = 100:
New Rating of Fighter A = 1500 + 100*(1–0.5) = 1550
New Rating of Fighter B = 1500 + 100*(0–0.5) = 1450
We can see that when K is larger, the ratings of fighters change a lot faster when new information comes in.
- Extra parameters: customized to MMA fights
An MMA fight has different endings. A fight can end in one of the three ways:
- Finish — The winner “finishes” the loser either by knockout or submission before the time limit.
- Unanimous decision — The time limit has passed. All three judges agreed on the same fighter as the winner.
- Split decision — The time limit has passed. All three judges don’t agree on the same fighter as the winner. The fighter with the majority wins.
From the winner’s perspective, a finish is more impressive than a unanimous decision and a unanimous decision is more impressive than a split decision.
To incorporate this information, we added three multipliers to K with the following relationship:
Finish Multiplier ≥ Unanimous Decision Multiplier ≥ Split Decision Multiplier
These multipliers help further distinguish between different fighters’ ratings (based on impressiveness of their endings).
For example, if fighter A beats fighter B with a finish:
New Rating of Fighter A = Current Rating of Fighter A + Finish Multiplier *K*(1–We)
New Rating of Fighter B = Current Rating of Fighter B + Finish Multiplier *K*(0–We)
As a result, fighter A’s rating will rise more than the other two types of endings. And fighter B’s rating will sink more than the other two types of endings.
First, we set the range of possible values to the parameters as below:
10 ≤ K ≤ 300
Finish Multiplier ≥ 1.0
Unanimous Decision Multiplier = 1.0
Split Decision Multiplier ≤ 1.0
Different combinations of the three undecided parameters (K, Finish Multiplier, Split Decision Multiplier) were tested using the cross-validation method.
We found that the best values in terms of prediction accuracy are below:
K = 200*
Finish Multiplier = 1.05
Unanimous Decision Multiplier = 1.0
Split Decision Multiplier = 0.5
*Sports such as baseball, football and chess usually have K ranging from 10 to 30. K = 200 shows that mixed martial arts ratings fluctuate much more than other sports.
Now that we are done the “boring” part. We can simply insert the values of the parameters into the Elo formula and update the ratings of the fighters with each new match.
We are ready to see the results!