MMA Elo Engine

Introduction

The Elo rating system, named after Arpad Elo, is a method for calculating the relative skill levels of players in zero-sum games.

Martial arts competitions are a prime example of zero-sum games. MMA in particular has risen in popularity through various event hosting platforms such as ONE, UFC, and Bellatore.

The popularity of these zero-sum games/competitions often begs the question, “Who is the greatest fighter?”

Project Overview

In this project, I developed a full stack web scraping application that helps answer such a question using the Elo rating system. It provides a multitude of API endpoints for fetching fighter data including their Elo rating.

I utilized Scrapy for web scraping, PostgreSQL as my database technology, FastAPI to create my backend API, and React to develop the frontend. The web application is simple with little features outside of fetching the GET API endpoints currently, but it currently is just a side project to practice my skills in full stack software engineering. Right now, I am working on re-implementing the backend fully in Rust instead of Python.

Understanding Elo Ratings

Elo is a rating system used to calculate the relative skill levels of players in two-player games such as chess, and in some cases, in combat sports like MMA. It provides a way to rank competitors based on their performance against one another.

Mathematical Definition

The Elo rating system calculates a player’s new rating based on the following formula:

\[R_{new} = R_{current} + k (S - E_{S})\]

Where:

  • $R_{new} :=$ New rating
  • $R_{current} :=$ Current rating
  • $k :=$ DevElopment coefficient (a constant that determines how much a player’s rating can change after each match)
  • $S :=$ Actual score (1 for a win, 0 for a loss, and 0.5 for a draw)
  • $E_{S} :=$ Expected score, calculated using the following formula:
\[E_{S} = \frac{1}{1 + 10^{(R_{opponent} - R_{current}) / 400}}\]
  • $R_{opponent}:=$ Rating of the opponent

Intuitive Understanding

To understand Elo intuitively, think of it as a way to gauge a player’s skill relative to their opponents. When a player wins against a higher-rated opponent, their rating increases significantly because it indicates a strong performance. Conversely, if a lower-rated player loses to a higher-rated one, their rating decreases less dramatically.

For example, if Fighter A (rated 1400) beats Fighter B (rated 1600), Fighter A’s rating will increase significantly, while Fighter B’s will decrease significantly. However if Fighter B were to beat Fighter A, then their ELOs would still change, but less dramatically since this is result is closer to the estimated expected outcome.

Code

Preview

Workspace config and Project Preview