Soccer Predictions using Python (part 5)
Hello again, and welcome to the final post in this series.
Final post at least for now as I think the code is working about as best as it can using this method of prediction.
It appears to be around 70% accurate in predicting home/draw/away and around 60% in the over/under 2.5 predictions.
Obviously, there are other things that could be inferred from the poisson distribution. It wouldn't take much, for example, to calculate odds for each individual score line. I leave any such improvements to the world at large. :-)
The main reason for this post is for a quick description of how to get the code running on a Windows Python installation.
I've made some updates to the code, done some tidying up and changed the scraping method slightly. The biggest change was removing the selenium webdriver as this wasn't necessary, it now uses the standard requests module.
So, here's a brief explanation of what I did to confirm it works on Windows.
I installed a fresh copy of Windows (Win7/64 - won't matter if you're on 8, 10, or even XP) and then installed the standard Python 3.6.2 distribution - I used the "Windows x86-64 executable" installer package from python.org.
Once this was done, I downloaded soccerprediction.py, put it in it's own folder, opened a command prompt and changed directory to the location of the file. In my case, it was d:\python\soccerpredictions\
Then, to install the dependencies I ran
pip install pandas
pip install requests
pip install beautifulsoup4
The pandas install brings down the numpy module as well as a few others, so I didn't need to install numpy.
python soccerprediction.py -t
successfully completed the backtest and output the following.
Score of 66.67% with history setting of 400 and cutoff of 70
Validation score of 88.89%
If the above scores seem acceptable, you should use these options
soccerprediction.py -c "England" -l "Premier League" -y 400 -b 70
Good Luck!
The next Premier League games are on the 30th of September so I then ran
soccerprediction.py -c "England" -l "Premier League" -y 400 -b 70 -d 2017-09-30
Which gives only one prediction from the seven to be played on that day.
Manchester United v Crystal Palace : Prediction:Manchester United Win, Probability:76.69, Odds:1.30
There are predictions for the other six games, you can find them in the file data\England-Premier-League.csv. If you run the code yourself, you'll see that there are a couple of games with predicted home win probabilities of ~59% but since this is lower than the 70% cutoff the backtest provided the code doesn't flag these as worthwhile bets (they might be though).
Anyway, that's enough from me for now. I'll be continuing to use this code myself but don't intend to develop it any further for the foreseeable future.
I've started work on a Poloniex Trading Bot and will be posting some articles about my progress soon.
Later. :-)
Hey man thanks for the cool program, and for helping me making python work. Now I have no excuse to start learning :) already messing around with the predictions.
All the best bud. Before long you'll be writing your own programs. I won't be surprised if you improve the code massively too.
:-)
Aahah no way, I was aiming at something alot more simple. Btw how do you change the program to predict results from other leagues like Bundesligue for instance?
For Bundesliga use
You can find valid options for -c and -l by going to Soccer Punter and selecting from any of the dropdown menus at the top. Then you can copy portions of the URL.
For example, if you click on the 2nd dropdown (where it says Club Domestic), select "Argentina", then it lists the competitions for that country. If click on "Torneo Federal A 2017/2018" it opens the page for that competition.
Take the URL.
www.soccerpunter.com/soccer-statistics/Argentina/Torneo-Federal-A-2017-2018
would translate to
Another example.
www.soccerpunter.com/soccer-statistics/Europe/UEFA-Champions-League-2017-2018
You can use spaces or dashes in both options, but if you use spaces remember to use quotes too.
Alright thank you, I was trying just that, but getting nothing, I closed everything now its working, I'll make sure its the name in the Url aswell maybe it was that.
I've noticed a problem with some competitions that it gives a lot of 100% & 0% probabilities - this seems to be because the teams in the competition vary so much from season to season.
The same problem can be seen in matches where a team has recently been promoted.
So, don't believe it if it's says 100% probability.
Have fun.
This post recieved an upvote from minnowpond. If you would like to recieve upvotes from minnowpond on all your posts, simply FOLLOW @minnowpond
Congratulations @stevencurrie! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of posts published
Award for the number of upvotes
Award for the number of upvotes received
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Data stopped from 2018/2019 season. Scrapping restarts from 2010 again.