dirusali / pokerodds

Odds checker for hands of poker
18 stars 14 forks source link

Too slow (even with numba) for practical use? #1

Open sword134 opened 3 years ago

sword134 commented 3 years ago

I've run the code with the card combination that you listed in your medium article, the flop took just about 150 seconds to run. The bottleneck appears to be in the scores.py however I am horrible at using numba so I have no idea as to speed it up. I already did a bit of a speed up by saving the hand combinations to a .csv instead of having to redo them all the time.

dirusali commented 3 years ago

Well, my intention was to try and see how much I could speed it up using numba, on my system it runs much faster than 150 seconds (maybe almost fast enough for practical use), but obviously, in a real game, you don't want to do these calculations on the fly. We'd rather save the data in a file as you mention or even better, in a database, and make queries for the values we need, if I have time I will do that and add it to the repo :)

sword134 commented 3 years ago

@dirusali Would it be wrong to assume that this repo is doing a Monte Carlo simulation? The mix of Spanish variables makes it a bit hard for me to exactly conclude that. Because there is another repo that performs a monte carlo simulation much faster that I am using which is kind of weird how this one is so slow (with numba, the other one doesn't use numba).

I am talking about this repo: https://github.com/amagana8/poker-monte-carlo

Also i'd like to hear your explanation on this repo of yours: https://github.com/dirusali/trainyourmodel

dirusali commented 3 years ago

@sword134 To say what is a Monte Carlo simulation and what is not is difficult since it is a very fuzzy concept. My repo is modeling all possible outcomes it is kind of a Monte Carlo process but longer, the repo that you are showing me is more of a "pure" Monte Carlo but with very small size of sample, because it is calculating only 100 or 20 simulated hands.

Of course, it is much faster than mine, you can see the difference in calculations is huge.

For practical use, the amagana8 Repo can suffice, even many players can generate a probability range in their minds very similar to the result of amagana8, however, if you played perfectly based only on expected value (which never happens in real life) you would always beat amagana8, in the long run, using my model because it is more accurate.

My repo trainyourmodel aims to build a machine learning platform using Django where people with no data science knowledge can train the most popular models with a CSV file and only one click.

I am glad to hear that you liked my projects, I plan to write an article on medium this week explaining the trainyourmodel repo from scratch and hopefully a quick video tutorial showing how to use the tool, hope you will like it :)

sword134 commented 3 years ago

@dirusali When you do finish that article, please comment it here on this issue and then you are of course free to close the issue! Good luck.

dirusali commented 3 years ago

@sword134 I already published the article here: https://towardsdatascience.com/the-coolest-data-science-project-for-2021-778361b5d80

Hope you enjoy it :)