You are on page 1of 6

Predicting Football Matches using Neural Networks in MATLAB®

__________________________________________________________________________________________________________________________

Predicting Football Matches using Neural Networks in MATLAB®


Andrade, Pablo; Cisneros Jorge; Suárez Francisco

Escuela Politécnica Nacional, Faculty of Mechanical Engineering, Quito, Ecuador
Mechatronics

Abstract:

The purpose of this project is to anticipate the outcome of a football match of a local team (LDU) using various types
of neural networks via MATLAB®. To achieve the objective of the project a series of input data has to be collected
in relation with the football team in question, the data was collected based on past matches records against
different teams. With the relevant data and the target for the project three virtual neural networks where trained
(Perceptron, Feed-Forward and Cascade) and simulated with the latest match played by the home team to see if
the network could predict accurately the outcome of the match.
The best results were achieved with the implementation of a feed-forward neural network. These results as well as
the results from the other types of networks utilized are thoroughly discussed in this project.

fare, simply because the analysis can use more data. On the
other hand, the bigger the percentage of the data that is used
1 1 INTRODUCTION for testing, the more statistically reliable our test will be. In
order to split all of the data, Weka offers a very good solution
There are many methods to predict the outcome of a football for this problem, namely a ten-fold cross validation. It splits
match. It can be predicted via a statistic model, using an the data into ten equal-sized portions and uses nine out of ten
ordered probit regression model. This particular method was portions as training data and the last one as testing data. It
used to predict English league football matches [1]. repeats the process ten times, each time choosing a different
In the static model, a wide range of variables were taken in portion as the testing data [2].
account, in addition to the different teams past matches’ The selection of the relevant features is an important feature
results data. These variables are the significance of each since an accurate set makes it a lot easier to predict the
match for championship, promotion or relegation issues; the outcomes of matches. Features are characteristics of recent
involvement of the teams in cup competition; the matches of the teams involved, but how far in history do we
geographical distance between the teams’ home towns; and need to go in order to get the best predictions? To answer this
a ‘big team’ effect [1]. question we set up a very basic set of features and then each
Knowing that these results will serve as a starting point in time we changed the amount of history looked at and
establishing the prices and award for betting in the sports compared the results. This initial set included the following
industry, the efficiency of such prices is also analyzed using features:
empirical results [1].  Goals scored by home team in its latest x
A limited but increasing number of academic researchers matches
have attempted to model match results data for football. It is  Goals scored by away team in its latest x
in this way that it can be observed that different distributions matches
are used, such as the poisson and the negative binomial
distributions [1].  Goals conceded by home team in its latest x
The statistic take on predicting football matches is widely matches
used for increasing the betting chances of the user, however ,  Goals conceded by away team in its latest x
the algorithm also requires training the machine. A database matches
is collected during the past years to have an analysis sample
 Average number of points gained by home
for training and for validation. The bigger the percentage of
the data that is used for training, the better the system will team in its latest x matches

Andrade, Pablo: Mechanical engineering student


Cisneros, Jorge: Mechanical engineering student
Suárez, Francisco: Mechanical engineering student

1
Andrade, Pablo; Cisneros Jorge; Suárez Francisco
_____________________________________________________________________________________________________________________________ __

 Average number of points gained by away quantitative strength of the connections between variables,
team in its latest x matches allowing probabilistic beliefs about them to be updated
automatically as new information becomes available. A
The x stands for the (variable) number of matches looked at. Bayesian network for a set of variables X = {X1,…..,Xn} consists
The first four features are pretty straightforward, the last two of:
describe the points the home and away team gained in their 1. A network structure S that encodes a set of
latest matches. These are calculated as in the football conditional independence assertions about
competition itself, namely, 3 points for a win, 1 for a draw and variables in X,
0 for a loss. The average over the latest x matches is taken. By
importing the features in Weka and letting several machine
2. A set P of local probability distributions
learning algorithms classify the data as described in Section associated with each variable. Together, these
1.3, a percentage of correctly predicted instances is given. components define the joint probability
Now that an optimal number of matches to be considered has distribution for X. The network structure Si s a
been found, we can move on to selecting the best possible directed acyclic graph.
classifier (machine learning algorithm). These will by means
of a certain machine learning algorithm classify all matches as The BN used in the research of ref. [3] is as follows:
home wins, draws or away wins, depending on the features
belonging to that match. During the previous test round a
selection has already been made. Below is a list of seven
classifiers includi ng a short description of each one:
 ClassificationViaRegression – This algorithm
uses linear regression in order to predict the
right class.
 MultiClassClassifier – This algorithm is a lot
like ClassificationViaRegression, except that it
uses logistic regression instead of linear
regression.
 RotationForest – This algorithm uses a A neural network approach can be established to predict the
decision tree to predict the right class. results of football matches. It is the case of ref. [4]. In that
work, the input and output variables were known, however
 LogitBoost – This is a boosting algorithm that
the hidden layer and weight distributions were not known.
alsouses logistic regression. Another way of obtaining the wanted results, a compound
 BayesNet – This algorithm uses Bayesian approach can be adopted, as explained in ref. [5]. The authors
networks topredict the right class. designed FRES (Football Result Expectation System), which
 NaiveBayes – This algorithm resembles consists of two major components: a rule based reasoner and
a Bayesian network component. This approach is a compound
BayesNet, except
one in the sense that two different methods cooperate in
 Home wins – This algorithm will, regardless of predicting the result of a football match.
the feature set, always predict a home win. The reasoning can be divided into two stages, strategy-
making and result-calculating. Strategies include overlapping,
In the previous section we have already seen that the first two man-marking, pressing, position, and passing. The results
perform best, using the given simple feature s et. We now from Bayesian networks form the bases for these decisions.
expand our feature set by a few more features and make Each team is assumed to have its own particular
several selections of them to see which classifier is best. characteristics, such as work rate, aggressiveness, pass
Please note that the “home wins”-classifier is used merely as length, etc. Jess takes all these facets into consideration to
a reference. It can immediately be seen that this classifier determine a strategy. As well as play-making strategies, the
performs worse than all the others. system also reasons about higher-level decisions such as
A Bayesian Network was used to predict the results of substitutions and formation changes. The result calculating
Barcelona FC team in the Spanish League [3]. During the last part models the actual flow of a match. It models such aspects
decade, Bayesian networks (and probabilistic graphical as the effect of goals on morale, the effect of reputations,
models in general) have become very popular in artificial relative scores, and locations on the state of the players. The
intelligence. Bayesian networks (BNs) are graphical models state changes throughout the match – for example, perhaps
for reasoning under uncertainty, where the nodes represent a team’s morale is very good at one moment; if nothing
variables (discrete or continuous) and arcs represent direct special happens for a long time then their morale can be
connections between them. These direct connections are expected to converge to normal [5].
often causal connections. In addition, BNs model the

2
Predicting Football Matches using Neural Networks in MATLAB®
_________________________________________________________________________________________________________________________

A Bayesian network, Bayes network, belief network,  Cascade


Bayes(ian) model or probabilistic directed acyclic graphical  Feed forward
model is a probabilistic graphical model (a type of statistical  Perceptron
model) that represents a set of random variables and their
These networks will be defined using the NNTOOL toolbox of
conditional dependencies via a directed acyclic graph (DAG).
MATLAB.
For example, a Bayesian network could represent the
The results of these simulations are shown in the next section.
probabilistic relationships between diseases and symptoms.
Given symptoms, the network can be used to compute the
probabilities of the presence of various diseases [6].
2.3 Simulation
The simulation process consists in adding the statistics of the
WHAT
last match and compare the simulation with the result in the
reality.
The project intends to create an artificial neural network
capable of predicting within a reasonable margin of error the
outcome of a football match during a specific season based
on statistical data from past seasons and performance ratings 3 RESULTS
from the players as well as the team as a whole when playing The results of the different networks are presented for LIGA
against other team from the same league. DE QUITO firstly.

WHY 3.1 LIGA DE QUITO


 Mathematical and statistical challenge
3.1.1 Perceptron
 The process needed to train an artificial neural
network can be implemented in other similar
applications
 Advancing the artificial intelligence field.
 Betting

2 METHODOLOGY
The team to be analysed will be LIGA DE QUITO this being the
last winners of the stage in the Ecuadorian Cup.
A neural network will be established for each team, taking in
account the statistics from 15 matches of the last season.
These statistics are taken from
http://www.futbolmetrics.com. [7]

2.1 Inputs.-

1. Shooting ratings
2. Effectivity ratings
3. Goalkeeper saves
4. Team defensive challenges won
5. Goals in favor
6. Goals against

2.2 Outputs.-

1. Winning the match.


2. Drawing the match.
3. Losing the match.

The neural network methodology consists in establishing


three different types of network:

3
Andrade, Pablo; Cisneros Jorge; Suárez Francisco
_____________________________________________________________________________________________________________________________ __

3.1.3 Cascade

3.1.2 Feed forward

4
Predicting Football Matches using Neural Networks in MATLAB®
_________________________________________________________________________________________________________________________

3.2 SIMULATION However, the error in this network is null for predicting the
The statistics of the match taken in account are the ones of losses and the winnings.
the second match of the second season of the 2015, as shown
below [7]. In the simulation, this network did not predict accurately the
outcome of the test match, effectively, it shows a winning
score.

4.2 Feed forward

This network was implemented with 3 layers with 10 neurons


in the first and second layers.

The feed forward network begins with a large error, but the
training process reduces the error dramatically. Effectively,
the error in the last training was in the order of 4 ∗ 10 −10 .

The results of the training were proven to be very accurate


comparing with the target. There were no values that differed
with the expected results.

In the simulation process, it is the only network that


These simulations will be done in each neural network. The accurately predicted the outcome, it predicted a draw (very
combined results of these simulations are shown below. close to 1).

4.3 Cascade
This network showed a good trai ning process, a reduced error
in each training.

The error in the learning process turned out to be small for


the last training, in the order of 4 ∗ 10 −10 .
The expected result is a draw, i.e. a matrix as of:
[ 0; 0; 1] The simulation result of this neural network was not
The simulation that better suits the result is for the Feed conclusive, since it didn’t predict any outcome, the values of
Forward network: drawing, losing and winning were 0.
[𝟑. 𝟔𝟒𝟓𝟑𝒆 − 𝟎𝟔; 𝟎. 𝟎𝟎𝟏𝟐𝟔𝟒𝟗; 𝟎. 𝟗𝟗𝟖𝟓𝟑]

4.4 Applications
4 DISCUSSION AND APPLICATIONS This work can be applied with further refinement in the input
variables to predict the outcome of a football match.

4.1 Perceptron Network Another application of this project can be in other sports.

The perceptron network is the simplest kind of network and


it has a better visual way of comparing the results. Effectively,
the perceptron network shows values of 1, 0 or -1. This makes
it easier to compare.

The training stage is also easier, however, the results did not
converge, and the network always reached the maximum
epoch without a conclusive result.

The error in predicting the result of drawing is large.

5
Andrade, Pablo; Cisneros Jorge; Suárez Francisco
_____________________________________________________________________________________________________________________________ __

5 CONCLUSIONS AND
RECOMMENDATIONS
 The best suited neural network for this project
is the Feed forward network, since it was the
one that learnt that scoring more goals than
those the team receives translates into winning
the match.
 The perceptron network is not suited for this
kind of project, since it does not cope well with
drawings.
 The cascade network is not good for this
project, since it does not predict any outcome.
 The current network does not predict
accurately, since it needs the scored goals to
predict. Further variables are needed in order to
discard the goals from the inputs.

6 References
[1] J. Goddard, Modelling football match results and the
efficiency of fixed-odds betting, Swansea: University of
Wales.

[2] D. Buursma, Predicting sports events from past results,


Twente: University of Twente.

[3] P. E. a. F. S. M. Farzin Owramipur, "Football Result


Prediction with Bayesian Network in Spanish League-
Barcelona Team," vol. 5, no. 5, 2013.

[4] [Online]. Available:


http://neuroph.sourceforge.net/tutorials/SportsPredi
ction/Premier%20League%20Prediction.html.

[5] C. C. a. R. I. (. M. Byungho Min, "A Compound Approach


for Football Result Prediction," Seoul National
University, Seoul.

[6] "Bayesian network," [Online]. Available:


https://en.wikipedia.org/wiki/Bayesian_network.

[7] "http://www.futbolmetrics.com/," [Online].