Crates.io | liglicko2 |
lib.rs | liglicko2 |
version | 0.1.0 |
source | src |
created_at | 2024-11-02 14:29:20.485592 |
updated_at | 2024-11-02 14:29:20.485592 |
description | Lichess-flavored Glicko-2 rating system |
homepage | |
repository | https://github.com/niklasf/liglicko2 |
max_upload_size | |
id | 1432926 |
size | 45,614 |
Lichess-flavored Glicko-2 rating system with fractional rating periods and instant rating updates.
This does not (yet) exactly match the Lichess implementation. Instead, it's a proof of concept for potential improvements and parameter tweaks.
See http://glicko.net/glicko/glicko2.pdf for a description of the original Glicko-2 rating system. The following changes have been made:
use liglicko2::{RatingSystem, Score, Instant, Periods};
let system = RatingSystem::new();
let alice = system.new_rating();
let bob = system.new_rating();
let now = Instant::default() + Periods(2.3);
// Initial prediction is indifferent.
let expected_score = system.expected_score(&alice, &bob, now);
assert!(Score(0.49) < expected_score && expected_score < Score(0.51));
// Alice wins. Update ratings.
let (alice, bob) = system.update_ratings(&alice, &bob, Score::WIN, now).unwrap();
assert!(alice.rating > bob.rating);
let now = now + Periods(1.0);
// Alice is expected to win the next game.
let expected_score = system.expected_score(&alice, &bob, now);
assert!(Score(0.79) < expected_score);
See resarch/
for utilities to evaluate rating systems on real-world data.
liglicko2
is licensed under MIT or APACHE-2.0, at your option.