Machine Learning for Sports Betting: This is not a basic classification problem.
One of the most difficult problems in machine learning algorithms is sports betting. With tons of data at your disposal and the clear goal of selecting the winner, there is plenty of information! Classic classification models don't work well with betting strategies. One must instead use a custom-loss function in his neural networks to increase profitability. Here's how we explain it.
Simple betting strategies to win the English Premier League
Let's use odds from betting exchanges to implement some basic betting strategies. Decimal odds is the ratio between the total payout and the stake. In other words, odds of 2 means that you could win 2$ for a bet of 1$. This includes your stake. Inverse odds indicate the implied probability that you will be right. An odds of 2 equals a 50% chance to win (1/odds). You should therefore bet only on the teams that have the lowest odds, which is the team with the highest chance of winning.
Two basic strategies are presented for illustration.
"Win": Choose the team with the lowest odds of winning, or the one with the highest likelihood of winning.
"Win or draw": Bet on the team with lowest odds and place a bet on a draw.
Take the following odds: Bournemouth vs. Chelsea is 5.5-1.61 Chelsea has 1.61 odds. Therefore, we wager on Chelsea's win for the "Win” strategy, and a draw for the “Win or Draw” strategy.
Prediction accuracy vs. overall profitability. They aren't similar.
Let's now look at the two strategies for betting: "Win" vs. “Win or Draw."
The Betfair API was used to retrieve the data. Betfair is the world's largest betting exchange. The API provides exchange markets navigation and odds retrieval as well as bet placement operations.
These bar charts represent the accuracy of both the betting systems and their profit. Accuracy refers to the percentage of correctly placed bets divided by the total number (200 in this case). Profit is the sum you could have earned if you invested 1PS per bet.
The "Win or Draw," which has a 61% accuracy ratio, is shown in the first chart. The second chart shows however that the profit it generates, is much less than that of the "Win", strategies. 1PS vs. 12.
It is not a good idea to try and predict the outcomes of games more accurately, but rather focus on maximising our overall profit.
Neural network to predict betting outcomes
There is a lot to consider when choosing which team to place our money on. Bets are a perfect subject for Neural Networks, one of the most sought-after machine learning techniques.
We could, for example, use a classification neural net. A classification neural network (NN) is best when it is applied to problems with a discrete outcome. It can also be used when identifying which category belongs to a particular observation. You can think of Sentiment Analysis, or Hotdog, not Hotdog, as an example. It attempts to classify text into positive and negative sentiment.
We could create a neural network that can be applied to sports betting. This neural network would have three categories. This is how such a network looks like.
Our previous example of two simple betting strategies shows that we aren't trying to predict what the outcome will be, but rather which bet would make the most profit. The following architecture could be obtained if this algorithm is applied to a classification neural net. This architecture allows for a "no Bet" category.
Multi-label classification is what we end up with (not to confuse with multi-class classified). The outcome of a game can result in only one or two correct predictions. If the home team wins, there are two possible winning bets.
We must include bets that could bring us profit.
All bets do not offer the same reward. A bet of odds of 2 could generate 1PS of profit while one of odds of 1.1 can bring in a smaller profit of 0.1PS. However, both bets are subject to the same loss of 1PS, if they fail. Both bets are not equal. You can risk 1PS to earn 1PS, but not 1PS for 0.1PS.
This loss function will be used to account for this in the neural network. A loss function (or objective functions) is a way to measure how well a neural system does given its training sample. It also gives an indication of the expected output. For standard classification neural networks, loss functions are used such as the categorical Cross-Entropy. These functions would have the same weights for all bets and ignore any profitability discrepancies.
In this case, we want the model maximize the overall strategy's gain. Our custom loss function must also include the possible profit for each bet.
Custom loss function
Our custom loss function with Keras was added to TensorFlow.
In Keras, a loss function takes two arguments:
y_true - Vector of true label (Win Home, Draw, Win Home or Draw), Draw, Win Away/Win Away, Winaway, Win Away, or Draw. Based on our neural network architecture this is represented as a vector of 1 or 0. This vector represents a vector of 1 and 0. For example, a victory for the home team has the following y_true value (1,1,0.0,0.0,0).
y_pred = Vector of Predictions. It is the output of our neural net classifier.
Due to Keras limitations we are unable to pass the game's chances in the loss function, so we have to pass them along as additional items of y_true vector.
A little bit more python-code
Below is our custom-written loss function in Python.
In short, it measures profit/loss over input for each unit stake. For each observation (each match), the steps are as follows:
Take odds with the y_true input
Use odds to calculate the potential profit from each bet.
Add the profits from winning bets to the losses of one.
The expected P&L from this observation is obtained. This is multiplied by -1 to obtain a "loss to minimize" (and not an increase to maximize). many websites explain sports betting systems learn how to choose the right one
Komentar
Posting Komentar