def __init__(self, match_data, score_weighting=False):
        if match_data is None:
            raise ValueError("Data cannot be null")

        self._trained = False

        _, _, team_num_map = process.match_vectors(match_data)

        self.team_num_map = team_num_map

        homes = pd.unique(match_data.home_team)
        aways = pd.unique(match_data.away_team)
        teams = np.union1d(homes, aways)

        self.team_ratings = {}
        for team in teams:
            self.team_ratings[team] = Rating()

        self.avg_margin = 0
        self.num_draws = 0
        trueskill.setup(mu=25.0,
                        sigma=8.333333333333334,
                        beta=4.1666666666666,
                        tau=0.08333333333333334,
                        draw_probability=0.26)
        self.train(match_data, score_weighting)

        self.team_skills = np.zeros((len(teams), ))
        for team in teams:
            self.team_skills[self.team_num_map[team]] = \
                             self.team_ratings[team].mu
        return
Пример #2
0
    def __init__(self, data=None, goal_dif=False, n_iter=1000):
        if data is None:
            raise ValueError("Data cannot be null")

        self._trained = False
        matches, results, team_num_map = process.match_vectors(data)
        self.xs = matches
        self.ys = results
        self.team_num_map = team_num_map
        self.train(n_iter=n_iter)
Пример #3
0
    def __init__(self, data=None, inf_type='Var', goal_dif=False, n_iter=1000):
        if data is None:
            raise ValueError("Data cannot be null")

        self._trained = False
        all_vectors = process.match_vectors(data, goals=True, seperate=True)
        matches, results, team_num_map = all_vectors
        self.xs1 = matches[:, :, 0]
        self.xs2 = matches[:, :, 1]
        self.ys = results
        self.team_num_map = team_num_map
        self.inf_type = inf_type
        self.train(n_iter=n_iter)