onix.metrics module

Functionality for calculating ratings, weightings and the like

onix.metrics.victory_chance(r1, d1, r2, d2)[source]

Calculates the expected probability that one player will defeat another, based on the players’ Glicko ratings.

See: http://www.glicko.net/research/glicko.pdf (Eqs. 10 and 16)

Parameters:
  • r1 (float) – the first player’s Glicko R
  • d1 (float) – the first player’s Glicko RD
  • r2 (float) – the second player’s Glicko R
  • d2 (float) – the second player’s Glicko RD
Returns:

The expected probability that the first player will defeat the second

Return type:

float

Examples

>>> from onix import metrics
>>> print(metrics.victory_chance(1695, 43, 1630, 75))
0.5892424...
onix.metrics.gxe(r, d, d0=130.0)[source]

Calculates the GXE (or GLIXARE) rating based on the player’s Glicko rating. GXE corresponds to the expected win percent for the player on a ladder with no matchmaking. This allows it to be used as a substitute for W/L ratio on ladders with matchmaking and also provides a much better ranking metric than conventional Glicko-based options such as CREs. For more, see: http://spo.ink/glixare

Parameters:
  • r (float) – the player’s Glicko R
  • d (float) – the player’s Glicko RD
  • d0 (float, optional) – the starting RD for the ladder (which should correspond to the width of the rating distribution)
Returns:

The player’s GXE rating

Return type:

float

Examples

>>> from onix import metrics
>>> print(metrics.gxe(1923., 29.)) 
90.4029862...
onix.metrics.skill_chance(r, d, baseline)[source]

Calculates the probability that a player with a given Glicko rating has a “true rating” greater than a certain value.

Parameters:
  • r (float) – the player’s Glicko R
  • d (float) – the player’s Glicko RD
  • baseline (float) – the “true” rating to compare against
Returns:

The probability that the player’s “true rating” is greater than baseline

Return type:

float

Examples

>>> from onix import metrics
>>> print(metrics.skill_chance(1702., 55., 1630.)) 
0.904748...