def beat(self, competitor: BaseCompetitor): """ Takes in a competitor object that lost a match to this competitor, updates the ratings for both. :param competitor: the competitor that lost thr bout :type competitor: GlickoCompetitor """ self.verify_competitor_types(competitor) # first we update ourselves s = 1 E_term = self.expected_score(competitor) d_squared = (self._q**2 * (self._g(competitor.rd)**2 * E_term * (1 - E_term)))**-1 s_new_r = self._rating + (self._q / (1 / self.rd**2 + 1 / d_squared)) * self._g( competitor.rd) * (s - E_term) s_new_rd = math.sqrt((1 / self.rd**2 + 1 / d_squared)**-1) # then the competitor s = 0 E_term = competitor.expected_score(self) d_squared = (self._q**2 * (self._g(self.rd)**2 * E_term * (1 - E_term)))**-1 c_new_r = competitor.rating + (self._q / (1 / competitor.rd**2 + 1 / d_squared) ) * self._g(self.rd) * (s - E_term) c_new_rd = math.sqrt((1 / competitor.rd**2 + 1 / d_squared)**-1) # assign everything self._rating = s_new_r self.rd = s_new_rd competitor.rating = c_new_r competitor.rd = c_new_rd
def beat(self, competitor: BaseCompetitor): """ Takes in a competitor object that lost a match to this competitor, updates the ratings for both. :param competitor: the competitor that lost their bout :type competitor: ECFCompetitor """ self.verify_competitor_types(competitor) if self.scores is None: self.__initialize_ratings() # store the at-scoring-time ratings for both competitors self_rating = self.rating competitors_rating = competitor.rating # limit the competitors based on the class delta value if abs(self_rating - competitors_rating) > self._delta: if self_rating > competitors_rating: sign = -1 else: sign = 1 competitors_rating = self_rating + (sign * self._delta) self._update(competitors_rating + self._delta) competitor._update(self_rating - self._delta)
def tied(self, competitor: BaseCompetitor): """ Takes in a competitor object that tied in a match to this competitor, updates the ratings for both. :param competitor: the competitor that tied with this one :type competitor: DWZCompetitor """ self.verify_competitor_types(competitor) self_rating = self._new_rating(competitor, 0.5) competitor_rating = competitor._new_rating(self, 0.5) self._rating = self_rating self._count += 1 competitor.rating = competitor_rating competitor._count += 1
def beat(self, competitor: BaseCompetitor): """ Takes in a competitor object that lost a match to this competitor, updates the ratings for both. :param competitor: the competitor that lost their bout :type competitor: EloCompetitor """ self.verify_competitor_types(competitor) win_es = self.expected_score(competitor) lose_es = competitor.expected_score(self) # update the winner's rating self._rating = self._rating + self._k_factor * (1 - win_es) # update the loser's rating competitor.rating = competitor.rating + self._k_factor * (0 - lose_es)
def beat(self, competitor: BaseCompetitor): """ Takes in a competitor object that lost a match to this competitor, updates the ratings for both. :param competitor: the competitor that lost thr bout :type competitor: DWZCompetitor """ self.verify_competitor_types(competitor) self_rating = self._new_rating(competitor, 1) competitor_rating = competitor._new_rating(self, 0) self._rating = self_rating self._count += 1 competitor.rating = competitor_rating competitor._count += 1