styled logo

/ Scientific, Transparent, Trackable \

The ranking of participants within competitive events serves as a significant point of intrigue. Such rankings not only mirror the historical performance of participants in prior matches but also serve as a valuable tool for prognosticating future match outcomes. Within the context of this paper, we shall delve into the analysis of match data from the English Premier League to address the following pivotal queries: (1) What fundamental principles should underpin the ranking of participants? (2) To what extent can the ranking of participants serve as a reliable feature for forecasting match results?

Before delving into the specifics of our data-driven exploration, it is imperative to grasp a broader understanding of the various prominent methodologies employed for ranking participants.

  1. Introduction to ranking methodologies
    1. Traditional Points-based Accumulation Ranking

The traditional points-based accumulation ranking remains one of the simplest and most widely recognized methodologies. It assigns a predetermined number of points to different match outcomes, such as wins, draws, and losses, and then aggregates these points over a series of matches. The higher the accumulated points, the higher the ranking. While this approach offers straightforward interpretability, it may oversimplify the intricacies of match performance and lacks the ability to account for varying strengths of opponents.

  1. ELO Ranking

The ELO ranking system, initially developed for chess, has found widespread application in various competitive domains. It assesses participants' rankings based on their relative performance and the outcome of matches. A participant's rating evolves iteratively after each match, reflecting the deviation from expected match outcomes. ELO ranking adapts well to scenarios where participants have unequal match histories, and its simplicity and historical significance contribute to its continued popularity.

  1. Colley Ranking

Colley ranking centers around a matrix-based approach that seeks to balance participants' ratings while considering the schedule of matches. By constructing a matrix that accounts for interactions between participants, Colley ranking mitigates the influence of unequal match distributions and indirectly evaluates the strength of opponents. This method incorporates match dates to provide more recent performance insights.

  1. Colley Ranking, ELO Ranking and relative codes

Prior to delving into the specifics of these ranking algorithms, it is important to familiarize ourselves with the dataset at hand.

  1. Introduction to dataset

The dataset encompasses statistics from the Premier League over a span of three seasons, from 2020 to 2023. The English Premier League features 20 teams that compete in a round-robin format, playing 38 matches each season. Teams earn three points for a win, one for a draw, and none for a loss. Utilizing the provided dataset, our objective is to employ the ranking methodologies to promptly assess and rank each of the participating teams. Additionally, our ultimate goal is to construct a predictive model that can determine whether a home team will win its match or not. As seen from the below, the basic dataset includes these features.

Basic features

- Date = Match Date (dd/mm/yy)

- HomeTeam = Home Team

- Away team = Away Team

- FTHG and HG = Full Time Home Team Goals

- FTAG and AG = Full-Time Away Team Goals

- FTR = Full-Time Result (H=Home Win, D=Draw, A=Away Win)

Obviously, these features constitute the most immediately accessible factors influencing match outcomes. Yet, our primary objective revolves around an extensive exploration and meticulous construction of features derived from these fundamental data points. The aim is to cultivate features that exhibit high efficacy in accurately predicting the conclusive result of a game.

  1. Traditional Points-based Accumulation Ranking

Let's take a small example of how Traditional Points-based Accumulation Ranking is used in the Premier League. For example, let's consider a scenario where Liverpool, Man United, and Fulham compete in three matches each. In the first match, Liverpool emerges victorious against Man United, securing 3 points for their win. In the second match, Liverpool prevails over Fulham, once again adding 3 points to their total. However, in the third match, Fulham manages to hold Man United to a draw, and both teams earn 1 point each. After these three matches, the Traditional Points-based Accumulation Ranking would stand as follows:

Now, let's consider the following scenario: In the second match, Manchester United emerges victorious against Liverpool, securing 3 points. In the subsequent match, Fulham triumphs over Liverpool, also collecting 3 points. Lastly, in the third match, Fulham and Manchester United once again play to a draw, each team earning a single point. Now the updated ranking would stand as follows:

Based on this outcome, the current ranking still places Liverpool ahead of Fulham and Manchester United. However, this contradicts the actual results of the newest second round of matches. The reason for such a phenomenon is that the Traditional Points-based Accumulation Ranking fails to promptly consider the relative strengths of the teams.

Therefore, we have opted to utilize Colley Ranking and ELO Ranking to rank the participating teams in the Premier League.

  1. Colley Ranking

Colley Ranking surpasses traditional methods, considering match schedules and uneven distributions for accurate team performance assessment. Unlike traditional approaches, it integrates match dates and interactions, enabling precise evaluation with recent match history and opponents' strengths. Implementing the Colley Ranking method involves a matrix-based approach, as demonstrated in the following Python code snippet:

def update_colley_ranking(league_table, results_table):

teams = np.unique(np.concatenate([results_table['HomeTeam'].values, results_table['AwayTeam'].values]))

num_teams = len(teams)

c = np.zeros([num_teams, num_teams])

b = np.zeros(num_teams)

for _, row in results_table.iterrows():

home_team = row['HomeTeam']

away_team = row['AwayTeam']

home_team_goals = row['FTHG']

away_team_goals = row['FTAG']

full_time_result = row['FTR']

home_team_index = np.where(teams == home_team)[0][0]

away_team_index = np.where(teams == away_team)[0][0]

# Calculate the weight based on the number of previous matches

weight = calculate_weight(results_table, row['Date'], home_team, away_team)

c[home_team_index, home_team_index] += 1 * weight

c[away_team_index, away_team_index] += 1 * weight

c[home_team_index, away_team_index] -= 1 * weight

c[away_team_index, home_team_index] -= 1 * weight

if full_time_result == 'H':

b[home_team_index] += 1 * weight

b[away_team_index] -= 1 * weight

elif full_time_result == 'A':

b[home_team_index] -= 1 * weight

b[away_team_index] += 1 * weight

# Adding 2 to diagonal elements (total number of games) of Colley matrix

diag = c.diagonal() + 2

np.fill_diagonal(c, diag)

# Dividing by 2 and adding one to vector b

for i, value in enumerate(b):

b[i] = b[i] / 2

b[i] += 1

colley = pd.Series(np.linalg.solve(c, b), index=teams, name='ranking')

# Update the rankings in the results_table directly

results_table['HomeRanking'] = results_table['HomeTeam'].map(colley)

results_table['AwayRanking'] = results_table['AwayTeam'].map(colley)

return results_table

The update_colley_ranking function in the code computes team rankings from match outcomes. It creates a matrix that reflects match results and team interactions, while also factoring in match timing through a weight calculation for improved accuracy in assessing team strengths.

Through the integration of match dates, team interactions, and outcomes, the Colley Ranking method offers a comprehensive ranking system. This approach delivers a more precise reflection of team performance compared to traditional one.

  1. ELO Ranking

Similarly, ELO Ranking surpasses the limitations of Traditional Points-based Accumulation Ranking by adapting to varying match histories and opponents' strengths. Traditional methods treat all matches equally in terms of their impact on ranking. ELO Ranking, however, dynamically adjusts a participant's rating based on the expected outcome and their relative performance against opponents. This results in a ranking that is more sensitive to the quality of matches and opponent strengths. This nuanced approach is achieved through the following code snippet.

def expected_result_prob(home_score,away_score, weight = 400, home_field_advantage = 50):

# calculate the expected probabilities for a match between two teams

diff_h_a = home_score - away_score + home_field_advantage #here we can add home field advantage

we = (1/(10 ** (-diff_h_a/weight)+1)) #the actual formula to calculate the expected probability

home_team_prop = np.round(we,3)

away_team_prob = 1-home_team_prop

away_team_prob = np.round(away_team_prob,3)

return home_team_prop, away_team_prob

The provided code calculates the expected probabilities for a match between two teams based on their scores and incorporates a home field advantage. At first home_scor and away_score are both initialized to 1400. It uses a formula that takes into account the difference in scores and applies a weight to determine the likelihood of the home team winning. This function is essential for estimating the probabilities of match outcomes, which is crucial in ELO Ranking.

def actual_result(result):

if result == 'H':

home_team=1

away_team=0

elif result == 'A':

home_team=0

away_team=1

elif result == 'D':

home_team=0.5

away_team=0.5

return home_team, away_team

The given code defines a function that translates match results ('H' for home team win, 'A' for away team win, and 'D' for draw) into numerical values representing the relative performance of the home and away teams. In ELO Ranking, these numerical values are crucial for updating elo ratings.

def calculate_elo(elo_home, elo_away, final_result, k_value = 40, weight = 400, home_field_advantage = 50):

k=k_value

erh, era = expected_result_prob(elo_home,elo_away, weight = weight, home_field_advantage = home_field_advantage)

arh, ara = actual_result(final_result)

# the actual formula to calculate the new elo

updated_elo_home=elo_home + k*(arh-erh)

updated_elo_away=elo_away + k*(ara-era)

# round to nearest integer

updated_elo_home=np.round(updated_elo_home, 3)

updated_elo_away=np.round(updated_elo_away, 3)

# just to calculate the stakes

win_home = (1 - erh) * k

lose_home = (0 - erh) * k

draw_home = (0.5 - erh) * k

win_away = (1 - era) * k

lose_away = (0 - era) * k

draw_away = (0.5 - era) * k

stakes = [win_home, lose_home, draw_home, win_away, lose_away, draw_away]

return updated_elo_home, updated_elo_away, stakes

This code calculates updated ELO ratings for two teams based on the match outcome and their initial ratings (elo_home and elo_away). It combines the expected_result_prob() and actual_result() functions to determine the expected and actual performances of the home and away teams. The calculate_elo() function utilizes these calculated probabilities and results to update ElO ratings for teams, providing a quantitative measure of team performance.

  1. Accuracy of ranking standalone results

Based on the provided code, four new ranking-related data were constructed: HomeCOLLEY, AwayCOLLEY, HomeELO, and AwayELO. These represent the COLLEY and ELO rankings for the home and away teams, respectively. Before introducing the specific prediction model, let's initially examine the predictive accuracy of standalone rankings. Predicted outcomes are determined by comparing the magnitudes of HomeCOLLEY and AwayCOLLEY, as well as HomeELO and AwayELO. The resulting accuracy was then assessed by comparing the predicted outcomes against the actual race results (FTR):

These results emphasize the effectiveness of COLLEY rankings in more accurately foreseeing race results compared to ELO rankings. Regardless, both metrics exhibit predictive capabilities with accuracy exceeding 50%, which indicates they are both reliable features. Moving forward, let's examine the impact of incorporating these four variables as features into the predictive model and assess their contribution to enhancing the model's performance.

  1. Ranking as Feature for Model Performance Enhancement

This paper utilizes the soccer match prediction model from the linked article and introduces novel features (https://www.kaggle.com/code/saife245/football-match-prediction). The study then validates the effectiveness of this prediction model by applying it to the latest dataset spanning the years 2020 to 2023. Three categorical regression models, namely Logistic Regression, Support Vector Machine (SVM), and Random Forest, have been employed. The subsequent visualizations include three heat maps that provide insights into these models' performance. The Logistic Regression model achieves a prediction accuracy of 100%, while the Support Vector Machine (SVM) exhibits a lower accuracy of 57%. On the other hand, the Random Forest model demonstrates a higher prediction accuracy of 98%. When comparing the model prediction accuracy with the linked articles, it's evident that the introduction of ranking features has led to significant improvements. This improvement is particularly remarkable in the Logistic Regression and Random Forest models, where the prediction accuracy approaches perfection.

In summary, the integration of Colley ranking and ELO ranking into the predictive model serves as a highly effective strategy to enhance the accuracy of outcome prediction in soccer matches. These ranking methods provide valuable insights into team strengths and interactions, enabling the model to capture nuanced patterns that contribute to more precise predictions.