Martin Builds
  • Home
  • About/Contact
  • Privacy Policy
21 February 2018 by Martin
AI / ML, Data, Technology

My Automated Machine Learning Tipster Bot, on a Raspberry Pi

My Automated Machine Learning Tipster Bot, on a Raspberry Pi
21 February 2018 by Martin
AI / ML, Data, Technology

I programmed my £30 Raspberry Pi to automate picking football tips using machine learning techniques, which you can follow on twitter @PiBot_predicts

I say, anyone for tennis?

A while back I blogged about the potential of using predictive modelling for betting on Tennis.

I commented that bookmakers would likely tune their odds to maximise their profits based on what bets they had taken and what they would be likely to take. Therefore the bookmaker’s implied probability would sometimes be significantly different to “actual” probability and machine learning could be used to identify the most under-valued picks.  I hypothesised that as tennis is largely enjoyed for the sport itself and as such there would be a lot of data published on each match which could be exploited for profit.

flaw in plan

The ATP makes available a good selection of stats, first serve in % etc… but for the WTA all we easily get it the sets box-score. Which is a shame as if forces you to either halve the number of observations or drastically reduces the number of variables you can use. Sadly I conclude there’s not enough data on enough matches.

That thing they show at the end of the news

With tennis ruled out, on to football. Tennis and horse racing data is locked away, either by broadcasters or pay-wall APIs. Football by contrast is just always in your face. I have no interest in football but even I have a rough awareness of what’s going on. With four divisions widely reported on in the UK there is a lot of consistent data available, and a lot of potential match-ups to predict against.

Raspberry Ry

I have been wanting to do something significant with my Raspberry Pi for a while now, and automating picking betting tips seemed like a fun project.

I wrote a number of scripts to scrape a few sites for past results and upcoming fixture odds and the scripts I used to generate the initial training data were re-used on this new data. My predictions are then made for the following day’s games and top picks are selected based on those theoretically returning a profit combining book-maker’s implied with my predicted probability.

The model was initially trained on my gaming laptop (because why wouldn’t you want to use a GPU) so porting the code to run on an ARM device was less simple than I had hoped.

I chose to implement much of the logic in R as I’m much more familiar with this than Python. Unfortunately the R version available on raspbian’s apt-get repo was 3.1.1 which is not up to date enough to install the current version of the R library dplyr. And also not up to date enough to install the R library devtools to install a previous version… compile from source it was then. Took about two hours to compile on the Pi humming at 99% CPU utilisation but helpfully this gives me the same version on the Pi as I am running on my laptop.

Now it’s time to sit back and watch the money roll in.

Moneyball

Slight lie, I don’t actually bet any of my own money on this because I’m not entirely confident it works. I cross-validated against the 2016/2017 season, and then again including the year to date as depicted in the below plot.

fbot_1617_season_25_profit_from_326bets

The chart shows large fluctuations in success, plus a lot of loosing bets are made. In this simulation the bot comes out ahead, barely. And it may have ended on a peak. Making £25 net profit from 326x £1 bets over a year isn’t a stunning return, so instead I programmed the Raspberry Pi to post predictions to a blog here: pibotpreds.blogspot.co.uk, and also tweet top tips here: twitter.com/PiBot_predicts

Share/follow/re-tweet if you’re so inclined but please don’t put any money on what a £30 Raspberry Pi says. If you’ve not seen it yet, watch Moneyball. Also read the book.

 

analytics betting bot gambling R Raspberry Pi twitter

Previous articleThe Sport of ProgrammingNext article AWS Free-tier CPU Limits
  • Fake it ’till you make it
    In AI / ML, Find My Bricks, Lego, Technology
  • Fooling the Mind – Lessons Learned in VR
    In Game Dev, Gaming, VR
  • Re-visiting NHL Data
    In Data, Hockey
  • Starting Game Dev 10 Years Later
    In Game Dev, Gaming
  • Going Serverless
    In AWS, Site News
  • Cold Start
    In Find My Bricks, Opinion
This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Cookie settingsACCEPT
Privacy & Cookies Policy

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these cookies, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may have an effect on your browsing experience.
Necessary Always Enabled

Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.

Non-necessary

Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.