Small script to compute Bradley–Terry pairwise ranking model and upload results to Google Sheets
Clone or download
bjlkeng Merge pull request #1 from bjlkeng/log_score
Rescaling score using log scale.
Latest commit 43bf06b May 18, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information. First version of script. Mar 18, 2017
requirements.txt First version of script. Mar 18, 2017 Rescaling score using log scale. Apr 6, 2018

Bradley-Terry Model Ranking Script

A small script to compute Bradley–Terry model that:

  1. Pulls down pairwise match data from a Google spreadsheet.
  2. Computes the Bradley-Terry model with a simple regularization scheme (dummy games).
  3. Uploads the scaled scores back to the same Google spreadsheet in a new tab.

I quickly wrote this up in an afternoon so that we could track our relative rankings in ping ping at the office. I put it on a cron job and give everyone access to the sheet at work.


  • You will need to setup an API key for gspread to access your Google sheet:
  • Make sure you share the target Google sheet with the email address associated with your credentials (usually a randomly generated one).
  • The "Game Data" sheet should have 5 columns: date, Player A, Player B, Wins A, Wins B
  • The "Ranking" sheet show the score for each player scaled between 0 and 1000. It can be interpreted as probability of Player A beating Player B is (Score_A) / (Score_A + Score_B).