Module skillratings::glicko2
source · Expand description
The Glicko-2 algorithm, an improvement on Glicko and widely used in online games, like Counter Strike: Global Offensive, Team Fortress 2, Splatoon 2 or Lichess.
If you are looking for the regular Glicko rating system, please see Glicko
.
The main improvement over Glicko is the rating volatility which is the expected fluctuation of a players rating, based on how consistent a player is performing. The lower the volatility, the more consistent a player performs.
Quickstart
This is the most basic example on how to use the Glicko-2 Module.
Please take a look at the functions below to see more advanced use cases.
use skillratings::{
glicko2::{glicko2, Glicko2Config, Glicko2Rating},
Outcomes,
};
// Initialise a new player rating with a rating of 1500, a deviation of 350 and a volatility of 0.06.
let player_one = Glicko2Rating::new();
// Or you can initialise it with your own values of course.
// Imagine these numbers being pulled from a database.
let (some_rating, some_deviation, some_volatility) = (1325.0, 230.0, 0.05932);
let player_two = Glicko2Rating {
rating: some_rating,
deviation: some_deviation,
volatility: some_volatility,
};
// The outcome of the match is from the perspective of player one.
let outcome = Outcomes::WIN;
// The config allows you to specify certain values in the Glicko-2 calculation.
// Here we set the Tau value to 0.9, instead of the default 0.5.
// This will increase the change in volatility over time.
// According to Mark Glickman, values between 0.3 and 1.2 are reasonable.
// For more information on how to customise the config,
// please check out the Glicko2Config struct.
let config = Glicko2Config {
tau: 0.9,
..Default::default()
};
// The glicko2 function will calculate the new ratings for both players and return them.
let (new_player_one, new_player_two) = glicko2(&player_one, &player_two, &outcome, &config);
More Information
Structs
- Struct to calculate ratings and expected score for
Glicko2Rating
- Constants used in the Glicko-2 calculations.
- The Glicko-2 rating of a player.
Functions
- The 95% confidence interval of the lowest to highest rating.
- Decays a Rating Deviation Value for a player, if they missed playing in a certain rating period.
- Calculates the expected outcome of two players based on glicko-2.
- Calculates the expected outcome of a player in a rating period or tournament.
- Calculates the
Glicko2Rating
s of two players based on their old ratings, deviations, volatilities, and the outcome of the game. - The “traditional” way of calculating a
Glicko2Rating
of a player in a rating period.