Learning to Rank Sports Teams on a Graph

: To improve the prediction ability of ranking models in sports, a generalized PageRank model is introduced. In the model, a game graph is constructed from the perspective of Bayesian correction with game results. In the graph, nodes represent teams, and a link function is used to synthesize the information of each game to calculate the weight on the graph’s edge. The parameters of the model are estimated by minimizing the loss function, which measures the gap between the predicted rank obtained by the model and the actual rank. The application to the National Basketball Association (NBA) data shows that the proposed model can achieve better prediction performance than the existing ranking models.


Introduction
It is often necessary to determine the importance of an alternative compared to others in a group. The process of ordering a list of alternatives based on their relative strengths is referred to as ranking. In this paper, we focus on ranking methods with applications to sports. Ranking of individual players or teams in sports, both professional and amateur, is a tool for entertaining fans and developing sports business. Moreover, it is of great significance to provide relevant personnel with reference to the strengths of competitors.
Recent years have seen increasing interest in ranking elite athletes and teams in professional sports leagues and in predicting the outcomes of games. Several methods have been proposed since the last century. Examples of these ranking methods include the Elo method [1], the Keener method [2], the Massey method [3], the Colley method [4], the logistic regression/Markov chain (LRMC) method [5,6], and the network-based method [7]. More recently, due to the extraordinary success of Google's PageRank, an algorithm originally developed for ranking web pages based on their importance [8], graph-based algorithms have gained more ground in the topic of sports ranking problems. The graph-based methods, such as PageRank and its extensions, have been adopted to rank individual players or teams in tennis [9], soccer [10], basketball [11], football [12], rugby [13], and hockey [14].
Although PageRank considers the indirect effect between games through the graph model, like most ranking models, these efforts, which just use game points and win-loss information, pay little attention to obtaining a comprehensive representation to measure the marginal effect of each game. The performance of players and teams is influenced by a variety of causes [15]. For example, the effects of home wins and away wins should be treated differently [16]. As another example, in basketball games, in addition to points, assists and rebounds are also important factors used to measure the strength of a team [17]. To solve this problem, the idea of learning to rank can be used to learn a comprehensive representation of each game.
Learning to rank is first used in information retrieval where machine learning algorithms are used to learn to rank candidate documents in a query according to their relevance to the query. In learning to rank, ranking is considered as a supervised learning problem, and several machine learning algorithms have been applied to it. The work in [18] provided a detailed overview of learning to rank. Learning to rank on a graph is ranking the results of queries that are executed against graphical data, such as social media, linked data, semantic web data, and a semantic bibliographic network [19]. In these graphs, nodes represent entities, and edges mimic interactions or relationships. The work in [20] extended the well-known PageRank authority flow-based ranking method to entity relationship graphs in order to learn an authority flow weight vector.
The sound data index system has been developed for basketball games, providing the possibility and demand for a more comprehensive ranking system. In this paper, we focus on the ranking methods in basketball. A general framework is proposed to learn the setting parameters in a game graph with various game information and rank the teams by an extended PageRank method. Moreover, due to the model setting, our model has the power to realize FutureRank, predicting the rank of teams in the future. The rest of this paper is organized as follows. Section 2 presents the framework of learning to rank sports teams on a graph. In Section 3, the methodology is applied to the data for the National Basketball Association. More aspects about the empirical results are discussed in Section 4. Concluding remarks and future research are summarized in Section 5.

Data Description
The National Basketball Association (NBA), consisting of two conferences, each with 15 teams, is the organization responsible for professional basketball in the United States. During a regular season in the NBA, where home and away competition system is adopted, each team plays 82 games, resulting in a total of 1230 regular season games. A large amount of statistical data are generated after each game, which provide a rich laboratory for studying various aspects of the sport. Box score data are a structured summary of the results from a basketball game, which contains comprehensive information about the game. The box score lists the game score, as well as individual and team achievements in the game. In our research, NBA box score data from the 2009-2010 season to 2018-2019 season were collected from www.nba.com. An example of the data is shown in Table 1.

Graph Construction
Like the traditional PageRank method, the network of sports teams is considered as a weighted directed graph. We construct the graph from the viewpoint of Bayesian correction, which is similar to the Elo method. It will be shown that the building process can provide a more statistical explanation for the model. The construction process is illustrated as follows. Let N(a, b) represent the normal distribution with mean a and variance b. For a game k between team i and team j, we assume: where X k i (X k j ) and S i (S j ) denote the performance vector and strength of team i(j), respectively. ρ(X k i , X k j ; θ) is set as the link function with parameter θ to integrate game information including the performance of two teams. h(S j ; γ j ) is a discount factor dependent on S j with a team-wise parameter γ j , which allows taking the opponent's strength into account in the measurement of the effect of one game. Furthermore, the strength S i is considered as a stochastic variable with prior distribution N(S 0 i , τ 2 ). Let R(i) denote the set of games that team i has played and g(k, i) denote the opponent team of team i in game k. Then, the posterior mean of S i can be given by: where R(i) is the cardinal number of the game set R(i). The posterior mean of each team's strength can be calculated in the same fashion. Then, we will have a network with strengths that flow from team to team. Suppose there are n teams to be ranked.
. Then, the rating vector is recursively defined as follows.
where Diag(α) is the diagonal matrix composed of the vector α whose i-th element is equal to Assume H(S, γ) = Diag(γ)S, and let A = WDiag(γ). Then, we obtain the generalized PageRank rating system, To preserve the column stochastic property of matrix A, we design γ j as a normalization constant in practice, i.e., γ j = ∑ i A ij . The rating vector for teams is retrieved from the solution of the linear system. Then, the team's ranking can be obtained directly from the rating vector.
We hope the link function ρ(·, ·; θ) is set to ensure the non-negativity of matrix A. Hence, an exponential function is considered, i.e., With the link function, the problem of dangling nodes in PageRank can be avoided, and such a setting ensures that even the strength of the losing team will be corrected.
In addition to the team's performance, schedule factors should also be considered, the foremost of which is the home advantage. Throughout nearly ten seasons of NBA games, the home team's win rate reaches 59.02%. The advantage deriving from playing at home is commonly taken into account by including a common home effect parameter η for all teams, thus leading to the function: where I k i is an indicator variable, i.e., It can be seen that the parameter exp(η) acts as a discount factor, which discounts the performance of the home team.
For convenience, we call this extended model TeamRank. Figure 1 shows an example to visualize the 2018-2019 NBA season network constructed with the first three days' games. Compared with the traditional PageRank method, the generalized model has the following advantages.

1.
Prior information can be incorporated, which allows our model to be aggregated with other ranking models.

3.
The link function considers a multidimensional performance vector, which contains more information than game points or wins.

Parameter Estimation
The model is used to evaluate the true strength of the team. Therefore, to estimate the parameters, a valid loss function should be designed to measure the gap between the estimated value of the team's strength and the actual value. Assume the list of teams is ranked L times, and then, the parameter estimation can be given by minimizing the loss function, where Θ = (θ, η, τ 2 σ 2 ) andŜ (k) (Θ) and S (k) are the rating vector obtained from (5) and the true strength vector of the teams in the k-th ranking, respectively. Considering a measurement of ranking accuracy, the negative Kendall rank correlation is used as the loss function. The function is defined as follows.
where sgn(·) is the sign function and the subscript i refers to the i-th element in the vector. This means that the estimation process will choose the parameters that make the team's strength rating most relevant to the true value. Since the objective function is not continuous, it is solved by gradient-free optimization algorithms, such as the genetic algorithm.

Results
In this section, we apply the proposed ranking method to the data of NBA collected from the 2009-2010 season to 2018-2019 season. Five continuous variables (points, rebounds, assists, turnovers, and fouls) and one binary variable (home field advantage) are used as the input for the link function of the model. For each season, the game graph is constructed by the first half of the games (615 regular season games), and the total wins of the half are employed as the prior distribution for each team's strength. The number of games a team wins throughout the season is used as a measurement of the team's true strength. In the training process, the rating vector and the loss function are computed for the first six seasons, and the parameters are estimated by minimizing the total loss. Then, the testing process is done over the four seasons left.
The estimated parameters in the link function ρ(X; θ) are shown in Table 2. The estimated result is in line with common sense. These indicators of points, rebounds, and assists all have a positive effect on the team's strength; at the same time, turnovers and fouls have the opposite effect. In addition, home advantage will bring a 1 0.8266 , 120.97% improvement to the home team's performance, which is similar to the ratio of the home team's winning percentage of 50%. The testing results are evaluated by three criteria: Kendall rank correlation, prediction accuracy, and playoff accuracy. For each season in the testing sets, the Kendall rank correlation is calculated between the rating vector estimated from the first 615 games and the true strength vector. The winning team of one game is predicted as the team with a higher rating value. Then, the prediction accuracy is computed for the 615 games left. A team ranked in the top eight in the conference will be predicted as a playoff team. Playoff accuracy is defined as the correct proportion of teams that are predicted to enter the playoffs.
Comparisons are done between the proposed model and several popular ranking methods with applications primarily to sports [21], including the Colley method, the Massey method, the PageRank method, and the Elo method. The simplest model in which the team's rating is computed by the current wins is set as the baseline. The results are shown in Tables 3-5.   As shown in the results, the proposed model has the best performance with an average correlation of 0.7540, prediction accuracy of 65.34%, and playoff accuracy of 89.06%. In most seasons, the TeamRank model outperforms other models. Although the prediction accuracy of the Elo model is close to that of TeamRank, the correlation and playoff accuracy of TeamRank exceed the Elo model greatly.

Correlation Analysis
To discuss the difference between the rank results of these models, a correlation graph is plotted for these models' ranking results in Figure 2. It can be seen that compared with other models, the ranking given by the PageRank method differs greatly from the true ranking. Figure 2 shows that the results of PageRank are not similar to the results of other models. This is because the two NBA teams will play multiple times in one season. The PageRank algorithm reduces the results of multiple games to a total goal difference, ignoring the marginal effect of a single game. For example, consider that team j wins one game with team i by a score of 121 to 100 and loses a second game by a score of 90 to 91. The two margins of victory would be summed and modeled as a single weighted edge of two points from team i to team j in the PageRank model. Consider another example where team j wins one game with team i by a score of 110 to 100 and wins a second game by a score of 100 to 90. The two margins of victory would be summed and modeled as a single weighted edge of 20 points from team i to team j as well. However, obviously, the strength contrast between the two situations is completely different. The TeamRank model is game-wise, which constructs the graph game-by-game. Hence, compared with the traditional PageRank model, this generalized model improves the prediction ability of the graph model.
The problem of ignoring the marginal effect of a single game also exists in the models of Colley and Massey, which makes them unable to measure the impact of the opponent's strength following a specific game. Like the TeamRank model, the Elo method considers the influence of the opponent's strength on the team rating. However, the Elo method only focuses on the points, and the update following one game is non-recursive, which makes it impossible to modify the impacts of previous games. Although the predictive ability of Colley, Massey, and Elo is not as good as the TeamRank model, the high correlations with the results of the baseline model show that the three models are hindsight models, which indicates that they have good backtesting ability.

Dynamic Ranking
In addition to the prediction of the half-season, the game graph can be updated according to the progress of the games, thereby updating the team's rating vector to achieve a dynamic ranking. We present the dynamic ranking results updated every 300 games in the 2018-2019 season in Figure 3. Figure 4 presents the change of rank in four seasons from 2015 to 2018 for eight NBA teams. It can be seen that some teams, such as San Antonio Spurs, have maintained a stable strength for four seasons. On the contrary, some teams have large fluctuations in their rankings during one season, such as Miami Heat and Los Angeles Clippers.

Conclusions
In this study, we described a generalized PageRank model to rank teams in a sports league. In the proposed model, a game graph is constructed from the viewpoint of Bayesian correction, which allows the strength to flow from team to team after games. The adjacency matrix of the graph is calculated by a link function that synthesizes all aspects of each game, including game results and schedule information. The unknown parameters in the model can be learned under the guidance of the actual ranking of teams. The loss function of a negative Kendall correlation is minimized to estimate the parameters. The application of this model was implemented with the NBA data. In each season, with the data of half a season, the strength of each team is evaluated, and the team's ranking of the total season is predicted. Our model outperforms other widely used models in three criteria: Kendall rank correlation, prediction accuracy, and playoff accuracy. The model in this paper improves the prediction ability of the PageRank-like models and provides coaches, media, and fans with a more accurate reference to the ranking of teams' strengths.
The proposed model takes into account the marginal impact of each game on the team's strength assessment. However, the time factor is not taken into account, that is the effect of one game may weaken over time. The game can be weighted by the length of time intervals in future work. Moreover, there may be more effective function forms for the link function and the loss function. More complicated forms can be tried for improvement. Besides basketball, the proposed method can be applied to rank teams or athletes in other sports fields.