glicko v0.3.0 Glicko.Player
Provides convenience functions that handle conversions between Glicko versions one and two.
Usage
Create a v1 player with the default values for an unrated player.
iex> Player.new_v1
{1.5e3, 350.0}
Create a v2 player with the default values for an unrated player.
iex> Player.new_v2
{0.0, 2.014761872416068, 0.06}
Create a player with custom values.
iex> Player.new_v2([rating: 3.0, rating_deviation: 2.0, volatility: 0.05])
{3.0, 2.0, 0.05}
Convert a v2 player to a v1. Note this drops the volatility.
iex> Player.new_v2 |> Player.to_v1
{1.5e3, 350.0}
Convert a v1 player to a v2.
iex> Player.new_v1 |> Player.to_v2(0.06)
{0.0, 2.014761872416068, 0.06}
Note calling to_v1
with a v1 player or likewise with to_v2
and a v2 player
will pass-through unchanged. The volatility arg in this case is ignored.
iex> player_v2 = Player.new_v2
iex> player_v2 == Player.to_v2(player_v2)
true
Link to this section Summary
Functions
The recommended initial rating value for a new player
The recommended initial rating deviation value for a new player
The recommended initial volatility value for a new player
Creates a new v1 player
Creates a new v2 player
A version agnostic method for getting a player’s rating
A version agnostic method for getting a player’s rating deviation
A convenience function for summarizing a player’s strength as a 95% confidence interval
Scales a player’s rating deviation
Scales a player’s rating
Converts a v2 player to a v1
Converts a v1 player to a v2
A version agnostic method for getting a player’s volatility
Link to this section Types
Link to this section Functions
The recommended initial rating value for a new player.
initial_rating_deviation(version_t()) :: rating_deviation_t()
The recommended initial rating deviation value for a new player.
The recommended initial volatility value for a new player.
new_v1([rating: rating_t(), rating_deviation: rating_deviation_t()]) :: v1_t()
Creates a new v1 player.
If not overriden, will use the default values for an unrated player.
new_v2([rating: rating_t(), rating_deviation: rating_deviation_t(), volatility: volatility_t()]) :: v2_t()
Creates a new v2 player.
If not overriden, will use default values for an unrated player.
A version agnostic method for getting a player’s rating.
rating_deviation(player :: t(), as_version :: version_t()) :: rating_deviation_t()
A version agnostic method for getting a player’s rating deviation.
A convenience function for summarizing a player’s strength as a 95% confidence interval.
The lowest value in the interval is the player’s rating minus twice the RD, and the highest value is the player’s rating plus twice the RD. The volatility measure does not appear in the calculation of this interval.
An example would be if a player’s rating is 1850 and the RD is 50, the interval would range from 1750 to 1950. We would then say that we’re 95% confident that the player’s actual strength is between 1750 and 1950.
When a player has a low RD, the interval would be narrow, so that we would be 95% confident about a player’s strength being in a small interval of values.
scale_rating_deviation_to(rating_deviation :: rating_deviation_t(), to_version :: version_t()) :: rating_deviation_t()
Scales a player’s rating deviation.
Scales a player’s rating.
Converts a v2 player to a v1.
A v1 player will pass-through unchanged.
Note the volatility field used in a v2 player will be lost in the conversion.
to_v2(player :: t(), volatility :: volatility_t()) :: v2_t()
Converts a v1 player to a v2.
A v2 player will pass-through unchanged with the volatility arg ignored.
volatility(player :: t(), default_volatility :: volatility_t()) :: volatility_t()
A version agnostic method for getting a player’s volatility.