glicko2 ranking system
The Glicko-2 rating system is a method for assessing a player's strength in games of skill, such as chess and go. The algorithm is explained by its author, Mark E. Glickman, on http://glicko.net/glicko.html.
Each player begins with a rating, a rating deviation (accuracy of the rating) and a volatility (speed of rating evolution). These values will evolve according to the outcomes of matches with other players.
First we initiate a ranking manager and create players with initial ratings, rating deviations and volatilities.
var glicko2 = require'glicko2';var settings =// tau : "Reasonable choices are between 0.3 and 1.2, though the system should// be tested to decide which value results in greatest predictive accuracy."tau : 0.5// rating : default ratingrating : 1500//rd : Default rating deviation// small number = good confidence on the rating accuracyrd : 200//vol : Default volatility (expected fluctation on the player rating)vol : 0.06;var ranking = settings;// Create playersvar Ryan = rankingmakePlayer;var Bob = rankingmakePlayer1400 30 0.06;var John = rankingmakePlayer1550 100 0.06;var Mary = rankingmakePlayer1700 300 0.06;
We can then enter results, calculate the new ratings...
var matches = ;matchespushRyan Bob 1; //Ryan won over BobmatchespushRyan John 0; //Ryan lost against JohnmatchespushRyan Mary 0.5; //A draw between Ryan and MaryrankingupdateRatingsmatches;
... and get these new ratings.
console.log"Ryan new rating: " + RyangetRating;console.log"Ryan new rating deviation: " + RyangetRd;console.log"Ryan new volatility: " + RyangetVol;
Get players list
var players = rankinggetPlayers;
You can easily enter results from games where multiple competitors play against each other at the same time (ie swimming, racing...).
First make "Race" objects by entering the results in an array of "positions", where each position is an array of players at this position :
var race1 = glickomakeRaceRyan //Ryan won the raceBob John //Bob and John ended ex aequo at the 2nd positionMary // Mary 4th position;var race2 = glickomakeRaceMary // wonBob // 2ndJohn // 3rdRyan // 4th;
Then convert the races to the equivalent matches :
var matches1 = race1getMatches;var matches2 = race2getMatches;var allMatches = matches1concatmatches2rankingupdateRatingsallMatches;
You can also update ratings for one race without converting to matches :
You should not update the ranking after each match. The typical use of glicko is to calculate the ratings after each tournament (ie collection of matches in a period of time). A player rating will evolve after a tournament has finished, but not during the tournament.
Here is what says Mark E. Glickman about the number of matches in a tournament or rating period (cf. http://www.glicko.net/glicko/glicko2.pdf ) :
The Glicko-2 system works best when the number of games in a rating period is moderate to large, say an average of at least 10-15 games per player in a rating period.