# Winning At Football Betting Using Machine Learning

The purpose of this article is to outline how we use artificial neural networks to select the football betting tips on the Frog The Gambler platform.

The new Gold Bets algorithm that we deployed on 21st September 2019 has got off to a decent start returning 10.7% on stakes for its first 148 bets over ten days.

Frogthegambler.com provides a tip for every football match worldwide that we can find odds for. The markets we currently consider for a tip are:

- 1X2 (home win, draw or away win in normal time)
- BTTS (both teams to score in normal time yes or no)
- OU 2.5 (over or under 2.5 total match goals in normal time)

This means that our model has to pick one of seven options to bet on in every match. Given that we are picking thousands of tips a week we thought it would be a good idea to mark our best selections as Gold Bets. No gambler has to bet on every match. The key to trying to win money through betting is to be selective.

Artificial neural networks have been my artificial intelligence tool of choice for creating winning betting systems since the early 2000s. My initial models were built using Microsoft Excel and third party tools such as NeuroShell Predictor from Ward Systems. In recent years I have coded everything myself using Python and Tensorflow.

Read on to get a better understanding of the reasoning behind our tips.

## 1. Frog’s neural network model to win at football betting

When I first sit down to have a crack at beating a market I always sketch a simple diagram of the AI for the model that I am trying to create. The diagram below shows a simplified version of my football betting model for the 1X2 market (home win, draw, away win).

The model starts with selecting the input data relating to the event. This data is then massaged and fed into a neural network as preprocessed inputs.

The initial goal of the model is to calculate the probability of each of the three outcomes happening. These probabilities are then converted into my odds and compared to the odds the bookies are offering. If the bookies are offering bigger odds than the model suggests it could be the opportunity for a bet.

Let’s look at each part of the model in more detail:

### i. The football model input variables

A model always starts off with the input variables. What factors are important when evaluating the chance of each team winning a match? Dozens come to mind such as:

- Home team advantage
- How many matches in their last five has each team won?
- Who concedes the most goals?
- Record of the away team on the road
- Are any key players missing?
- How are teams rated in my ratings?
- The current odds of each team to win the match

The key at this point is simplicity. There is no point in overfeeding the model so it will learn past history exactly and be useless at generalising trends for future matches.

I ended up narrowing it down to 17 input variables. Most of these were bespoke summary variables that combined lots of data such as my own attack and defence ratings for each team.

The current best bookmaker price of the home team, away team and the draw was also added. Historically I have resisted using prices but more recently I have found that bookmaker or betting exchange odds help models perform better as they can contain private (inside) information.

I did not use any data relating to team lineups as I needed to easily obtain data to feed into the models up to 48 hours before the match to make the selections for our readers.

### ii. The match results as output variables

Target variables for the neural network were the three match outcomes; home win, draw or away win.

Another option was to try and predict the score line so a 4-0 win would be seen as a stronger set of inputs than a 1-0 win. But in the end I settled for the simplicity of just the binary result. This made sense to me as the 1X2 result is what I was trying to predict.

### iii. The neural network structure and training

The network consisted as 17 preprocessed inputs with 3 outputs. There were two hidden layers with 340 nodes in each layer.

I used a ReLU activation function in the hidden layers. The output layer used a softmax activation function. This meant that the three outputs would sum to the value of 1. The individual outputs then represent the probability of each outcome happening.

I trained the network for 250 epochs for a total of 100 networks to create a model ensemble.

## 2. Calculating value in football betting

The trained neural networks were now able to have the input data fed into them to produce a probability of each of the three match results.

In the diagram above the predicted probabilities were:

Home Win = 0.5

Draw = 0.3

Away Win = 0.2

These probabilities can be converted into decimal odds by dividing 1 by them resulting in:

Home Win = 2.0

Draw = 3.33

Away Win = 5.0

In the example the best bookmaker odds are:

Home Win = 2.1

Draw = 2.8

Away Win = 4.3

Looking the odds we can see that the Home Win is the only outcome where the odds the bookmakers are offering is greater than the odds the model has. This is a value bet because, if the model is a good one, it has a positive expected value.

The model suggests the home team has a 50% chance of winning. Imagine placing a £10 bet on 10 bets with a 50% chance of winning. In the long run 5 bets would win and 5 bets would lose. Total stakes would be £100. The winners would return 2.1 x £50 giving a return of £105. This gives a £5 profit for £100 staked which is a 5% return on investment.

Lets look at the calculation for all three outcomes:

Selection | Probability | My Odds | Best Bookie Odds | Stake 10*£10 | Expected Return | Profit/Loss | ROI |
---|---|---|---|---|---|---|---|

Home Win | 0.5 | 2.0 | 2.1 | £100 | £105 | £5 | +5% |

Draw | 0.3 | 3.33 | 2.8 | £100 | £84 | -£16 | -16% |

Away Win | 0.2 | 5.0 | 4.3 | £100 | £86 | -£14 | -14% |

In this example backing the home team is a value bet according to the model. Backing the other two outcomes are not value bets.

The 100 different networks all produce slightly different value calculations for each outcome. The median value was taken for each of the outcomes from the 100 networks to give the final value measure.

## 3. Extending the betting system for BTTS and Total Goals markets

The goal of the betting system is pick one selection from the three betting markets we consider. This means two more sets of neural networks were required for the Over/Under 2.5 goals in the match and the BTTS markets.

I built similar models to the one for the 1X2 market but the target variables were different. In both cases the output was 2 rather than 3 outcomes. For the BTTS market there was one output for ‘Yes’ and one output for ‘No’. For the total goals market there was one output for ‘Over 2.5 goals’ and one for ‘Under 2.5 goals’.

For every match we run all sets of 100 neural networks and calculate the expected value for each of the 7 outcomes according to the betting system. Extending the example above we might have the following results:

Selection | Value |
---|---|

Home Win | +5% |

Draw | -16% |

Away Win | -14% |

BTTS Yes | -15% |

BTTS No | +7% |

Total Goals Under 2.5 | -1% |

Total Goals Over 2.5 | -5% |

In this case we can see that Home Win and BTTS ‘No’ both have a positive expected value. The BTTS ‘No’ outcome is the best with a 7% expected value so this is the selection that would be published on the Frog The Gambler website.

A selection is a ‘Gold Bet’ if the selection has an expected value of greater than 5%. These are depicted on the website with a Gold Button:

If the selection is of positive expected value but below 5% the preview will convey this message in the text.

Sometimes we have to make a selection even if we think the bet has a negative expected value. On these occasions the betting system cannot find fault with the bookmakers odds and beat their inbuilt margin. Again we will let users know this; for example:

Frog’s betting tips are just suggestions based on the model. Given the information available the user may form a different opinion and think that 1.5 offered on Bedford is in fact value in this case. That is the beauty of betting on sports. There is no objective answer, it is all about opinions.

## 4. The test results for the sample data

The latest model was built using 8,000 matches from spring 2019. 4,000 matches were used to build the model and 4,000 matches were held back for testing.

For each of the 3 markets 100 neural networks were built. The median expected value for each of the 7 outcomes was then calculated and the highest number results in the selection.

If the expected value of the selection is over 5% it is a Gold Selection.

Over the years I have found that a staking plan that takes account of the odds works best for me. The staking plan is as follows:

- If the odds are greater than 2.0 stake to win 1 unit. E.g. if the odds are 5.0 stake 0.25 units.
- If the odds are less than or equal to 2.0 stake 1 unit.

The data the model was built on (Orange) selected 480 Gold Bets from 4000 matches. The return on investment was 14.8%. This was extremely high and suggests some possible overfitting by the model.

The model was then tested on the next 4000 matches that were not used in the model development. A higher number of selections were Gold Bets (725) and the return on stakes was a healthy 6.9%.

## 5. The results in the first week the new algorithm was deployed on FTG

We updated the algorithm for all bets on the Frog The Gambler platform towards the end of September 2019. By Saturday 21st September all bets posted were based on the new algorithm.

Up until the end of September there were 148 suggested Gold Bets. Using the staking plan outlined above the return on investment was 10.7%. The chart below shows the cumulative profit and loss through time.

If a punter had decided to just use a flat rate staking plan and had placed a £10 wager on every Gold Bet suggested using the new model he or she would have staked £1480 and made a profit of £134.80.

## 6. Frequently Asked Questions

### i. How reliable are the historical betting results as a guide to future profit?

There is no guarantee that past results and model testing will result in future profits. In the last 20 years I have been gambling I have developed hundreds of betting models.

In my experience, provided that the testing is vigorous enough, they do tend to make a profit for a period of time. The return on investment is generally lower than the models suggest.

For instance, from 2002-2005 I was betting on every horse race in the UK on Betfair. My average return on investment was about 4.5% when my model suggested it would be around 7%.

Models also tend to make less overtime. If the gambler gets lazy and does not update the models to take into account any structural shift in the underlying sport/data a winning model can turn into a losing one. It is essential to monitor and update models on a regular basis.

The tips on Frog The Gambler are provided in good faith. **There cannot be any guarantee that following the Gold Bets over time will result in profit.**

### ii. Should I still bet if the price has changed?

The tips on Frog The Gambler are posted at the prices available at the point they are selected. Ideally they would be changed if there was a price change but unfortunately this would cause confusion for the readers.

We post the tipped time under every selection we make.

Bookmakers change their odds in the run up to game due to weight of money and a new information becoming available.

It is important to not bet if you have missed the price. If you want to bet on a tip I would recommend doing it as close as possible to the time the tip was posted.

In the example above the model suggested a price of 2.1 represented an expected positive return of 5%. If the price changes to 2.0 that expected return vanishes to zero. If the team goes to odds-on the expected profit becomes negative.

Alternatively the price could increase. This suggests increased value but the punter should be cautious if the price seems too big to be true.

### iii. Does the model include player line ups?

The model does not include player line ups. The tips are posted anything up to 48 hours before kick off and in that time a lot could change.

The image below from Odds Portal shows the odds available on Slovakia vs Denmark in 2018. Denmark opened at 2/1 with Bet365 but drifted out to 14/1 by kick off.

The reason for this was apparently a player strike and a very weak team was selected for Denmark. There is no way for the Frog The Gambler model to take this news into account. The computer simply does not follow news like this.

### iv. Why are there limited technical details of you neural network structures and input variables?

This article was not intended to be a technical article on how to build a model with neural networks. The intention was to provide an outline of the logic behind our tips. If the demand is there I will write a more technical article in the future.