glicko v0.1.0 Glicko.Player
A convenience wrapper that handles conversions between glicko versions one and two.
Usage
Create a player with the default values for an unrated player.
iex> Player.new_v2
%Player{version: :v2, rating: 0.0, rating_deviation: 2.014761872416068, volatility: 0.06}
Create a player with custom values.
iex> Player.new_v2([rating: 1500, rating_deviation: 50, volatility: 0.05])
%Player{version: :v2, rating: 1500, rating_deviation: 50, volatility: 0.05}
Convert a v2 player to a v1. Note this drops the volatility.
iex> Player.new_v2 |> Player.to_v1
%Player{version: :v1, rating: 1.5e3, rating_deviation: 350.0, volatility: nil}
Convert a v1 player to a v2.
iex> Player.new_v1 |> Player.to_v2(0.06)
%Player{version: :v2, rating: 0.0, rating_deviation: 2.014761872416068, volatility: 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
Creates a new v1 player
Creates a new v2 player
A convenience function for summarizing a player’s strength as a 95% confidence interval
Scales a players rating deviation
Scales a players rating
Converts a v2 player to a v1
Converts a v1 player to a v2
Link to this section Types
v1_t() :: %Glicko.Player{rating: float(), rating_deviation: float(), version: :v1, volatility: nil}
v2_t() :: %Glicko.Player{rating: float(), rating_deviation: float(), version: :v2, volatility: float()}
Link to this section Functions
new_v1([rating: float(), rating_deviation: float()]) :: v1_t()
Creates a new v1 player.
If not overriden, will use default values for an unrated player.
new_v2([rating: float(), rating_deviation: float(), volatility: float()]) :: v2_t()
Creates a new v2 player.
If not overriden, will use default values for an unrated player.
rating_interval(player :: t()) :: {rating_low :: float(), rating_high :: float()}
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 :: float(), to_version :: :v1 | :v2) :: float()
Scales a players rating deviation.
scale_rating_to(rating :: float(), to_version :: :v1 | :v2) :: float()
Scales a players 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.
Converts a v1 player to a v2.
A v2 player will pass-through unchanged with the volatility arg ignored.