Skip to content

Commit

Permalink
more docs and better outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
niklasf committed Nov 2, 2024
1 parent 9a66adb commit 2212909
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
21 changes: 20 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
liglicko2
=========

Lichess-flavored Glicko-2 rating system.
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:

- Optimized default parameters based on Lichess data. Optimal parameters
depend on the application, so this will not be ideal for all use cases.
- All rating components are clamped to specific ranges, so that even
pathological scenarios cannot cause degenerate results.
- Glicko-2 updates ratings in bulk in discrete *rating periods*. Lichess
instead updates pairs of ratings, so that ratings can be immediately
updated after each game.
- Lichess keeps the time decay of rating deviations, but generalizes it
to work with fractional rating periods.
- Allows considering an inherent advantage for the first player in a game.

Documentation
-------------
Expand Down
6 changes: 3 additions & 3 deletions research/src/bin/replay_encounters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ fn write_report<W: Write>(
for experiment in experiments.iter() {
writeln!(
writer,
"{},{},{},{},{},{},{}",
"{},{},{},{},{},{},{:.5}",
f64::from(experiment.rating_system.min_deviation()),
f64::from(experiment.rating_system.max_deviation()),
f64::from(experiment.rating_system.default_volatility()),
Expand Down Expand Up @@ -410,7 +410,7 @@ fn write_report<W: Write>(
{
writeln!(
writer,
"# Sample {:?} rating of {}: {} (rd: {}, vola: {})",
"# Sample {:?} rating of {}: {:.1} (rd: {:.3}, vola: {:.5})",
speed,
name,
f64::from(rating.rating),
Expand All @@ -432,7 +432,7 @@ fn write_report<W: Write>(
let avg = best_experiment.estimate_avg_rating(speed);
writeln!(
writer,
"# Estimated {speed:?} distribution: p1 {p1:.1}, p10 {p10:.1}, median {median:.1}, p90 {p90:.1}, p99 {p99:.1}, avg {avg:.1}",
"# Estimated {speed:?} distribution: p1={p1:.1} p10={p10:.1} p50={median:.1} p90={p90:.1} p99={p99:.1}, avg={avg:.1}",
)?;
}
writeln!(writer, "# ---")?;
Expand Down
13 changes: 8 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
//! Implementation of the Lichess-flavored Glicko-2 rating system.
//! Lichess-flavored Glicko-2 rating system system with fractional rating
//! periods and instant rating updates.
//!
//! See <http://glicko.net/glicko/glicko2.pdf> for a description of the
//! original Glicko-2 rating system.
//! This does not (yet) exactly match the Lichess implementation.
//! Instead, it's a proof of concept for potential improvements and parameter
//! tweaks.
//!
//! Lichess has made some modifications:
//! See <http://glicko.net/glicko/glicko2.pdf> for a description of the
//! original Glicko-2 rating system. The following changes have been made:
//!
//! - Optimized default parameters based on Lichess data. Optimal parameters
//! depend on the application, so this will not be ideal for all use cases.
Expand All @@ -14,7 +17,7 @@
//! updated after each game.
//! - Lichess keeps the time decay of rating deviations, but generalizes it
//! to work with fractional rating periods.
//! - Lichess may consider an inherent advantage for the first player in a game.
//! - Allows considering an inherent advantage for the first player in a game.
//!
//! # Errors
//!
Expand Down

0 comments on commit 2212909

Please sign in to comment.