Football Match Prediction Using Tree Models
Football Match Prediction Using Tree Models
Sani M. Isa
Computer Science Department, BINUS Graduate Program-Master in Computer Science,
Bina Nusantara University Jakarta, 11480, Indonesia
E-mail: [Link]@[Link]
Received: 26 January 2019; Revised: 27 February 2019; Accepted: 19 March 2019; Published: 08 July 2019
Abstract—This paper presents the football match the opposing team. The involvement of an expert is the
prediction using a tree-based model algorithm (C5.0, common solution, however that does not mean it is
Random Forest, and Extreme Gradient Boosting). unflawed. Human assistance as a tool in making decisions
Backward wrapper model was applied as a feature is not always reliable. Some psyche factors can influence
selection methodology to help select the best feature that the analysis of the outcome and cause the decisions that
will improve the accuracy of the model. This study used are made to be inappropriate.
10 seasons of football data match history (2007/2008 – In addition to relying on experts as a solution in
2016/2017) in the English Premier League with 15 initial helping decision making, several studies have been
features to predict the match results. With the tuning carried out in predicting the results of football matches
process, each model showed improvement in accuracy. [2,3,4,5,6]. Some studies have output limitation of
Random Forest algorithm generated the best accuracy football matches [2,4], the algorithm used is logistic
with 68,55% while the C5.0 algorithm had the lowest regression which only gives 2 output ‘home win’ or
accuracy at 64,87% and Extreme Gradient Boosting ‘away win’ while football match has 3 result possibilities,
algorithm produced accuracy of 67,89%. With the output ‘home win’, ‘away win’, or ‘draw’. Another study has
produced in this study, the Decision Tree based algorithm been conducted using the random forest algorithm [3],
is concluded as not good enough in predicting a football but the prediction accuracy is only 63,4%.
match history. Based on several studies conducted in making
predictions in other fields, in this study the authors
Index Terms—Football match prediction, supervised proposed a decision tree as the method of choice in
machine learning, decision tree, feature selection, predicting the end result of a football match. A sample
classification. research that uses a decision tree is the initial prediction
of a heart disease. The algorithms used in this study are
CART, ID3 and decision table, with accuracy values of
I. INTRODUCTION 83.49% using CART algorithm, 72.93% using ID3
algorithm, and 82.50% using decision table algorithm [7].
Football is a very popular sport among people of
Other studies were conducted to detect bad data using a
various ages and genders. This sport has been enjoyed
decision tree with an accuracy rate of 94% [8]. The use of
since the times of ancient Egypt, where it was played by
the XGBoost method carried out in generating predictions
kicking a ball formed from a collection of linen fabrics
of bank failures in America can produce up to 94.74%
[1]. The English Premier League is one of the leagues accuracy [9].
most favored by the public. Based on statistics from This study will use the C5.0, Random Forest and
ESPN on season 2017/2018, there are as many as 14,56
XGBoost algorithms from the decision tree method to
million viewers who attend these football matches. With
predict the outcome of a football match in the English
the high enthusiasm from the community towards football,
Premier League. With larger datasets and feature
the media and the community often try to predict of the selection method using backward wrapper method, it is
outcome of a football matches. expected to improve the prediction accuracy from
Presently, football is not only a means of a sport but
previous studies that have been done.
also a form of entertainment and investment. In investing,
This paper will be divided into five sections, including
an investor needs help from an expert to determine the
the introduction section. Section II describes the related
right decision to invest. Even so with a football coach,
works. Section III describes the research methodology
they need need guidance in developing a strategy to face
This work is open access and licensed under the Creative Commons CC BY 4.0 License. Volume 11 (2019), Issue 7
Football Match Prediction with Tree Based Model Classification
used in this research. Result and analysis will be artificial neural network and logistic regression with
described in section IV. Conclusions of this research knowledge discovery in database framework with 18
drawn in section V. features which consists of goals, shots, corner, odds,
attack strength, player’s performance index, manager
performance index, managers win and streak for each
II. RELATED WORKS home and away team. Artificial neural network method
has a prediction percentage of 75.04% and it improved to
Since football match prediction have become 85% by giving weight to the features. On another hand,
commonplace for people of all ages, several studies were the logistic regression method has a high accuracy
conducted to find out the criteria associated with football
percentage, 93%, but limited due to the results only
match result and the model that can generate the highest
obtain 2 values. Igiri [5] have another research for
accuracy in predicting football match result. These are
football match prediction using the SVM method with 15
following studies that have been conducted in order to features and reaching prediction percentage of 53.3%.
find the optimal model for football match predictions. Bayesian network method also used by Razali [Link]. [6] to
One study was done by Prasetio and Harlili [2] using
predict football match. They use shots, shots on target,
the logistic regression method and home offense, home
corners, fouls committed, yellow cards, red cards, half-
defense, away offense and away defense as their model
time goals, and full-time goals as features to build the
features with prediction numbers reaching 69.5%. A
model. In this research, the model prediction accuracy is
weakness in predicting the results of a soccer match using 75.09%.
the logistic regression method is that the results obtained
only have 2 values, where in reality, the results of a
soccer match can produce 3 final scores, namely win,
III. RESEARCH METHOD
draw or lose. Yezus [Link]. [3] produces predictions of
football matches using machine learning with K-nearest Fig. 1 will display a design experiment for this
neighbors and random forest algorithms, which use form, research. To predict football match results, this research
concentration, motivation, goal difference, score will have two major steps: data preprocessing and
difference, and history as key features to develop classification, with each step broken down into more
classifier and had accuracy values of 55.8% and 63.4%, detailed steps. This research will use R as a programming
respectively. Igiri and Nwachukwu [4] also conducted language to develop the model.
another research on football match predictions by using
name, and football team name. Attribute FTR (Full Time 1. Feature Selection
Result) will be used as the label of the model.
Feature selection is a process that is commonly used by
Table 1. Initial features
researchers to get a smaller part of the entire data. This
smaller set of data is chosen based on relevance, to
Features Data Scale Description improve the performance of the model created in the
Full-time result. Used as the label of training process [10]. This feature selection process will
FTR Nominal
the model
Number of goal for the home team in be very influential in the model training stage. From
HTHG Ratio initial feature candidates, the feature selection process
half time
HTAG Ratio
Number of goal for away team in will select some features that have relevance and process
half time data with the selected features to form the model.
Number of shot done by the home
HS Ratio
team
In this research, backward wrapper model will be used
AS Ratio Number of shot done by away team as a feature selection methodology. The classifier will act
Number of shot on target is done by as a black box and will use random forest algorithm as
HST Ratio
the home team the algorithm for the classifier. Features that have been
Number of shot on target is done by evaluated will be assessed for their performance by
AST Ratio
the home team
Number of fouls done by the home
utilizing the classifier. This will be done until all the
HF Ratio features have been tested. Feature with the highest
team
AF Ratio Number of fouls done by away team estimated value will be used in the development of the
Number of corners obtained by the classifier model. On this method, Random Forest will be
HC Ratio
home team used as a classifier method. Fig. 2 display the framework
Number of corners obtained by away of wrapper models [11].
AC Ratio
team
Number of yellow cards obtained by C. Classification
HY Ratio
the home team
Number of yellow cards obtained by Classification is one of the predictive methods of data
AY Ratio
away team mining. The purpose of classification is to get a
Number of red cards obtained by the
HR Ratio
home team prediction of future value based on other variables
Number of red cards obtained by contained in the dataset. The classification has four
AR Ratio
away team fundamental components: class, predictors, training
datasets and testing datasets [12]. This research will use
From a total 14 attributes in the initial feature, feature supervised machine learning (classification) technique as
selection will be done to only select the best attributes. a prediction method.
Only those that have the potential to have a good impact
on prediction and result accuracy, will be included in the
model development.
compare algorithms in the learning process by dividing each node randomly sample mtry of the predictors
the data into two parts. The first part is used for the and pick the best split among other variables.
learning process of the model and the second part is used • Predict new data by aggregating the predictions of
to validate the model [13]. the ntree tree.
This research uses K-fold cross-validation method,
with 10 as the number of K variable. This method will be With an ensemble of classifiers ℎ1 (𝑋) , ℎ2 (𝑋) , … ,
applied to model development using only training data. ℎ𝐾 (𝑋) and training dataset is drawn in the random forest
Fig. 3 explains how K-fold cross-validation work. from the distribution of vector X, Y, the margin function
can be expressed as formula (3).
𝑚𝑔(𝑋, 𝑌) =
𝑎𝑣𝐾 𝐼(ℎ𝐾 (𝑋) = 𝑌) − max 𝑎𝑣𝐾 𝐼(ℎ𝐾 (𝑋) = 𝑗) (3)
𝑗≠𝑌
where 𝜔 is the vector score in the leaves, 𝜆 is the generated the following combinations of HTHG, HTAG,
regularization parameters, and 𝛾 is the minimum loss HS, AS, HST, AST, HF, AF, HC, and HY. It is the best
needed to expand partition of the leaf node. feature combinations with prediction accuracy reaching
69.21%. Selected feature combinations will be used in
6. Evaluation Methodology
further model predictions using a tree-based model
The evaluation will use a confusion matrix to calculate algorithm.
each model’s prediction accuracy, kappa, F1, sensitivity,
and specificity. Each model will have one confusion Table 3. Features selection process
matrix that consists of each class from the chosen label. No. of Features Accuracy Kappa OOB Error Rate
The class will have 3 nominal value, H for home win, D 14 67,5% 0.4761 30,99%
for draw and A for away win. 13 68,16% 0.4882 31,84%
12 68,03% 0.4865 31,71%
11 66,97% 0.4708 31,48%
IV. RESULT AND ANALYSIS 10 69,21% 0.5080 31,71%
9 67,37% 0.4808 32,04%
A. Feature Selection 8 68,03% 0.4909 31,48%
Feature selection method used in this research is the 7 67,63% 0.4845 32,27%
wrapper method with a backward approach. From a total 6 66,45% 0.4675 33,59%
of 14 features available, features combination will be 5 64,61% 0.4375 36,02%
tested against the training model. Each combination will 4 63,55% 0.4266 36,38%
be measured by the accuracy percentage of the training 3 63,68% 0.4208 39,38%
model. Data partition in this feature selection will be 2 58,82% 0.3824 38,98%
80:20 which 80% of the available data used as training 1 55,26% 0.2694 44,54%
data. The model will use a random forest algorithm to B. Analysis of Tree-Based Classification Model
check the prediction accuracy of the model with the
parameter ntree is 500 and mtry is 2. ntree parameter used in The experiment process started by dividing the data
the Random Forest algorithm is the number of trees to into two partitions, training data, and testing data, with
grow while the model developed and parameter mtry is the composition of 80:20. Training data consists of 3,040
number of variables available for splitting at each tree data with 10 features and testing data consist of 760 data
node while the model developed. with 10 features.
From all number of feature combination available, 10
features combination has the highest prediction accuracy Table 4. Evaluation of training data using C5.0 algorithm
which is 69.21% and an out-of-bag estimate of error rate Rules
is 31.71%. The confusion matrix of 10 features Trial
Number Errors
combination is shown in table 2. 0 48 870(28,6%)
1 29 980(32,2%)
Table 2. Confusion matrix of 10 features combination 2 26 1054(34,7%)
Output Class 3 34 1072(35,3%)
Class
A D H 4 24 1075(35,4%)
Target A 153 50 22 5 26 1123(36,9%)
D 24 74 32 6 30 1045(34,4%)
H 36 70 299 7 33 1027(33,8%)
8 40 906(29,8%)
Table 3 shows the results of each feature combination 9 59 896(29,5%)
using the backward wrapper method. The process will Boost 741(24,4%)
have 14 iterations based on the number of features used
1. C5.0 Model
in this research. Feature deletion is done based on the
lowest feature importance on the generated training The first algorithm used in this experiment is C5.0. The
model. The table displaying accuracy, kappa and out-of- model trained with 10 trials and a rule-based tree.
bag error rate as a measurement on each model. Training data evaluation can be seen in table 4. The
Although not having the lowest out-of-bag error rate, model was evaluated using a confusion matrix to see the
the backward wrapper method concluded that 10 feature classification performance, this can be seen in table 5
combinations give the highest accuracy and kappa with accuracy reaching 75,534%.
number. To ensure the best feature combination, the The trained model is tested against testing data using a
training model re-generated the 10 feature combinations confusion matrix. The prediction accuracy result is 63,
by reducing 4 feature combinations for each iteration. 29% with Kappa 0.4095. The confusion matrix result can
The experiment result of 10 feature combinations be seen in table 6.
Output Class
Statistics
A D H
Sensitivity 0.6761 0.1546 0.8584
Specificity 0.8391 0.9205 0.6314
Kappa 0.3920
Accuracy 0.6276
tuning.
3. Extreme Gradient Boosting Model
The last algorithm used in this experiment is Extreme Table 12. Extreme Gradient Boosting Tuning Parameters
Gradient Boosting. With 10 fold cross-validation, the first Learner Initial Parameters
step in this experiment is to get the best iteration with the objective multi:softprob
lowest m-error. Based on the experiment run, 28 iteration eval_metric merror
is the best with the lowest testing m-error with value nrounds 250
0,3526. The m-error plot on each iteration of training and Parameters for Tuning
testing data can be seen on fig. 5 and fig. 6. Parameters Lower Upper
nrounds 200 600
max_depth 3 20
eta 0.001 0.5
lambda 0.55 0.6
subsample 0.1 0.8
min_child_weight 1 5
colsample_bytree 0.2 0.8
Fig.5. Training m-error plot on Extreme Gradient Boosting. Table 13. Extreme Gradient Boosting Tuning Result
Parameters
nrounds 204
max_depth 17
Eta 0.0178
lambda 0.5750
subsample 0.6610
min_child_weight 1,05
colsample_bytree 0.7580
test_mean_accuracy 67,0395%