sol.models.rating
– Ratings¶
-
class
sol.models.rating.
Rating
(**kwargs)¶ A particular rating a tournament can be related to.
-
default_deviation
¶ Default value of deviation (PHI) for the Glicko2 algorithm.
-
default_rate
¶ Default value of rate (MU) for the Glicko2 algorithm.
-
default_volatility
¶ Default value of volatility (SIGMA) for the Glicko2 algorithm.
-
description
¶ Description of the rating.
-
getPlayerRating
(player, before=None)¶ Return the rate of a player
Parameters: - player – a Player instance
- before – a date instance
Return type: an instance of glicko2.Rating
If before is not specified fetch the latest rate, otherwise the most recent one preceeding before.
The method considers the referenced rating as well as all those with an higher level.
-
higher_rate
¶ Higher value of the range used to interpolate players rates.
-
idrating
¶ Primary key.
-
inherit
¶ Whether to lookup rates in higher levels ratings.
-
isPhantom
(competitor)¶ Determine whether the given competitor is actually a Phantom.
Parameters: competitor – a Competitor instance This is needed because someone use a concrete player as Phantom, to customize its name (not everybody have a good sense of humor…)
-
level
¶ Rating level.
-
lower_rate
¶ Lower value of the range used to interpolate players rates when (almost) all competitors are unrated.
-
outcomes
¶ Kind of formula used to compute match outcomes.
This is used to determine which formula will be used to compute the match outcomes to feed Glicko2 algorithm. It may be:
- glicko2
- standard Glicko, giving 1.0 to the winner and 0.0 to the loser, 0.5 in case of draw, developed with Chess in mind;
- guido
- Guido’s variant, better suited to Carrom: basically each player is assigned a fraction of his own score divided by the sum of the scores of both players;
- expds
- an exponential formula applied to the two concurrents final scores difference.
-
ranking
¶ Players sorted by their latest rate.
Return type: sequence Returns: a sorted list of tuples containing the player
, its latest rate, deviation and volatility, and the number of rates in this rating.
-
recompute
(mindate=None, scratch=False)¶ Recompute the whole rating.
Parameters: - mindate – either
None
or a date - scratch – a boolean, True to recompute from scratch
If mindate is given, recompute the rating ignoring the tourneys before that date.
- mindate – either
-
serialize
(serializer)¶ Reduce a single rating to a simple dictionary.
Parameters: serializer – a Serializer
instanceReturn type: dict Returns: a plain dictionary containing a flatified view of this rating
-
tau
¶ Value of TAU for the Glicko2 algorithm.
-
time_span
¶ Return the time span of this rating.
-