Sunday 28 December 2014

Poker hands recognition (Machine Learning)

A few months ago I downloaded the scikit-learn package for Python, for those of you who might not be aware, scikit-learn is a powerful yet very simple package useful to apply machine learning. Basically they give you “all” the algorithms you may need and you “only” have to get the data and make it ready to feed into the scikit-learn algorithm.

Anyway, I only recently had time to check it out and write some code, furthermore only recently I found a great site full of sample datasets dedicated to machine learning (check it out here). Since the data from this great site is more or less in the right shape for being ready to import (.txt files or similar) the only task left to the programmer is to put it into numpy arrays.

This is one of my first attempt at generating a “real” machine learning program.

I won’t post the pre-settings script since it is pretty boring, instead I’ll briefly describe the pre-setting: basically, using a simple script I’ve splitted the training samples from the database in two .txt files trainingP.txt and target.txt respectively. TrainingP.txt contains the questions (the hands of poker) and target.txt contains the answers (=the score, that’s to say poker, full house etc… coded into numbers according to the description given in the database description file).

Below is the ml script: it is composed of 3 parts: setting, training and testing

setting: import the training sets and fit them into numpy arrays of the correct shape

training: fit the data into the model using scikit-learn

testing: test the algorithm and check what it has learned so far! Some statistics are printed, for reference. Check the results below!

So far the best score is 56.4%, I wonder if I did everything correctly! Anyway soon I will post a script with better results and achievements!


Below is the citation of the source of the database, according to their citation policy.


The name of the dataset is Poker Hand and it is from:


Bache, K. & Lichman, M. (2013). UCI Machine Learning Repository[http://archive.ics.uci.edu/ml]. Irvine, CA: University of California, School of Information and Computer Science.

14 comments:

  1. I'm certainly very happy to read this blog site posts which carries plenty of helpful data, thanks for providing such information.https://juegosdecasinoonlinecolombia.com.co

    ReplyDelete
  2. Your blog provided us with valuable information to work with. Each & every tips of your post are awesome. Thanks a lot for sharing. Keep blogging.. LorenPoker

    ReplyDelete
  3. This comment has been removed by the author.

    ReplyDelete
  4. I’ve been searching for some decent stuff on the subject and haven't had any luck up until this point, You just got a new biggest fan!.. http://103.9.100.48

    ReplyDelete
  5. This is a brilliant blog! I'm very happy with the comments!.. http://216.83.47.66

    ReplyDelete
  6. Nice to be visiting your blog again, it has been months for me. Well this article that i've been waited for so long. I need this article to complete my assignment in the college, and it has same topic with your article. Thanks, great share. pkv games

    ReplyDelete
  7. Thanks for the blog filled with so many information. Stopping by your blog helped me to get what I was looking for. Now my task has become as easy as ABC. black satta

    ReplyDelete
  8. I have bookmarked your blog, the articles are way better than other similar blogs.. thanks for a great blog! DominoQQ Virtual Namun Asli

    ReplyDelete
  9. Excellent .. Amazing .. I’ll bookmark your blog and take the feeds also…I’m happy to find so many useful info here in the post, we need work out more techniques in this regard, thanks for sharing. bet pt

    ReplyDelete
  10. It is a fantastic post – immense clear and easy to understand. I am also holding out for the sharks too that made me laugh. joker หน้าเว็บ

    ReplyDelete
  11. เบทฟิก You possess lifted an essential offspring..Blesss for using..I would want to study better latest transactions from this blog..preserve posting..

    ReplyDelete
  12. I found your this post while searching for some related information on blog search...Its a good post..keep posting and update the information. 먹튀검증사이트

    ReplyDelete
  13. The best development environment for businesses looking to hasten the delivery of flawless, high-quality apps. With its robust debugging tools, image annotation for farming, and seamless connectivity with well-known development environments, this team can work more productively and achieve exceptional outcomes. So check out the useful link below for more helpful information!

    ReplyDelete