Module skillratings::weng_lin
source · Expand description
A bayesian approximation method for online ranking. Similar to TrueSkill, but based on a logistical distribution.
Used in games such as Rocket League.
Developed by Ruby C. Weng and Chih-Jen Lin.
Unlike with the other algorithms, there does not seem to exist a short name everyone agrees upon,
so we are just calling it Weng-Lin, for short, after the researchers.
But the proper name would be A Bayesian Approximation Method for Online Ranking
.
Developed specifically for online games with multiple teams and multiple players, this algorithm aims to be simpler and faster (~2.5 - 6.5x) than TrueSkill while yielding similar accuracy.
While TrueSkill is based upon a Gaussian distribution, this algorithm is based upon a logistical distribution, the Bradley-Terry model.
Quickstart
This is the most basic example on how to use the Weng-Lin Module.
Please take a look at the functions below to see more advanced use cases.
use skillratings::{
weng_lin::{weng_lin, WengLinConfig, WengLinRating},
Outcomes,
};
// Initialise a new player rating with a rating of 25, and an uncertainty of 25/3 ≈ 8.33.
let player_one = WengLinRating::new();
// Or you can initialise it with your own values of course.
// Imagine these numbers being pulled from a database.
let (some_rating, some_uncertainty) = (41.2, 2.12);
let player_two = WengLinRating {
rating: some_rating,
uncertainty: some_uncertainty,
};
// 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 Weng-Lin calculation.
// Here we change the beta value from the default of 25 / 6 ≈ 4.167.
// The beta value measures the difference you need in rating points
// to achieve a ~67% win-rate over another player.
// Lower this value if your game is heavily reliant on pure skill,
// or increase it if randomness plays a big factor in the outcome of the game.
// For more information on how to customise the config,
// please check out the WengLinConfig struct.
let config = WengLinConfig {
beta: 25.0 / 12.0,
..Default::default()
};
// The weng_lin function will calculate the new ratings for both players and return them.
let (new_player_one, new_player_two) = weng_lin(&player_one, &player_two, &outcome, &config);
More Information
Structs
- Struct to calculate ratings and expected score for
WengLinRating
- Constants used in the Weng-Lin calculations.
- The Weng-Lin rating of a player.
Functions
- Calculates the expected outcome of two players based on the Bradley-Terry model.
- Calculates the expected outcome of mulitple teams based on the Bradley-Terry model.
- Calculates the expected outcome of a player in a rating period or tournament.
- Calculates the expected outcome of two teams based on the Bradley-Terry model.
- Calculates the
WengLinRating
s of two players based on their old ratings, uncertainties, and the outcome of the game. - Calculates the
WengLinRating
of several teams based on their ratings, uncertainties, and ranks of the teams. - Calculates a
WengLinRating
in a non-traditional way using a rating period, for compatibility with the other algorithms. - Calculates the
WengLinRating
of two teams based on their ratings, uncertainties, and the outcome of the game.