| | 0

Fun with Microsoft Azure Machine Learning #AzureML – Scenario: Roulette Permanencies

In December, I gave an entertaining lecture on Azure Machine Learning during our sepagoForum event in Cologne, titled “Fun with Azure Machine Learning”. In addition to a brief introduction to neural networks and AzureML, I presented a few different scenarios, in which I tried to figure out which neural networks may or may not solve specific tasks. One of these scenarios is presented here.

Scenario: Roulette permanencies

If you have ever have been to a casino you have probably seen this: There are people who note where the ball landed last, and if they find that (e.g.) it landed on the color black 10 times in a row, they will bet on red. These people think that if one color comes up so many times, the probability of the other color coming up next would increase after each round.

To be clear: This is of course mathematically untrue. The probability for each color is the same every time:

  •  French Roulette:
    48.6% red, 48.6% black and 2.8% green
  •  American Roulette:
    47.35% red, 47.35% black and 5.3% green

Neither the wheel nor the ball have a memory!

But let’s check whether machine learning will confirm the math, or could actually provide a system to predict the next color.

Neural networks are able to make predictions on the basis of what they have learned. This experiment tries to predict the next color in a game, based on the last 40 colors on a table.

E.g. the predicted color “red” based on the last round “red, black, red, red, black, black, …”:

The experiment is built simply in Azure Machine Learning Studio:

Data source and modelling

In order for the experiment to learn, it requires large amounts of data –  in this case a series (permanencies) of a thousand colors in a row. For this test it was important to me to use real permanencies of a real table at a real casino (not an internet casino).

I found a German casino which offers this data per table. A web site shows all counts and colors of a specific table for a given date. I found that the web site uses a json format for the raw data and a java script to display it on the site (thanks to fiddler). I wrote a PowerShell script to request this data for each day from October 2013 to December the 6th 2015. What I got was a training set of 253,400 results in a (lonnnnnng) row:

After some excel work I created a training set of  253000  records. Each record consists of  the color that came up and the 40 results that preceded it.

Accordingly, as a custom data set in AzureML:

Confusion Matrix

The confusion matrix looks quite promising. If all values are 100% in diagonal, the prediction is logically perfect. From  this special experiment I received the following matrix:

Results

The result is disappointing. The confusion matrix indicates that based on my training and verification data, the prediction is always “black”. And this is not true.

Conclusion

Roulette seems to work like the math predicts: The probability of each color is the same every time if you observe this for an extended amount of time. In real life, it may seem to you that this is not true and that the distribution of colors differs. This may be true: For a short time frame – but not in general.

What should you do? Don’t quit your job and gamble only for fun 😉