Calculate Elo ratings of MMA fighters
To use, load database.py with python -i database.py
To calculate the Elo rating of a fighter, get the link to the fighter's tapology page (e.g., https://www.tapology.com/fightcenter/fighters/nate-diaz), and use the 'calc' function.
Example:
$ python -i database.py
>>> calc('https://www.tapology.com/fightcenter/fighters/nate-diaz')
https://www.tapology.com/fightcenter/fighters/nate-diaz
win
https://www.tapology.com/fightcenter/fighters/nate-diaz
Opponents:
100% of opponents in database.
1000 ***************************************************************************
1201 ******************************************************************************************
1077 *********************************************************************************
1137 *************************************************************************************
1215 *******************************************************************************************
1254 **********************************************************************************************
1299 *************************************************************************************************
1262 ***********************************************************************************************
1424 ***********************************************************************************************************
1476 ***************************************************************************************************************
1594 ************************************************************************************************************************
1749 ***********************************************************************************************************************************
1760 ************************************************************************************************************************************
1799 ***************************************************************************************************************************************
1836 ******************************************************************************************************************************************
1782 **************************************************************************************************************************************
1688 ******************************************************************************************************************************
1515 ******************************************************************************************************************
1627 **************************************************************************************************************************
1666 *****************************************************************************************************************************
1710 *********************************************************************************************************************************
1794 ***************************************************************************************************************************************
1670 ******************************************************************************************************************************
1508 *****************************************************************************************************************
1696 *******************************************************************************************************************************
1918 ************************************************************************************************************************************************
2047 *********************************************************************************************************************************************************
1996 ******************************************************************************************************************************************************
1818 ****************************************************************************************************************************************
1967 ***************************************************************************************************************************************************
1921 ************************************************************************************************************************************************
2084 ************************************************************************************************************************************************************
2307 *****************************************************************************************************************************************************************************
2192 *********************************************************************************************************************************************************************
2192.849167000691
Once you have two fighters' Elo ratings, you can compute the probability of one fighter defeating the other with the expected_score function.
>>> expected_score(2000,1800)
0.7597469266479578
This means that the probability that a fighter with a rating of 2000 defeats a fighter with a rating of 1800 is about .76.