Poker-AI.org

Poker AI and Botting Discussion Forum
It is currently Sun Sep 22, 2019 10:18 pm

All times are UTC




Post new topic Reply to topic  [ 14 posts ] 
Author Message
PostPosted: Sun Apr 14, 2019 2:01 am 
Offline
New Member

Joined: Sun Apr 14, 2019 1:30 am
Posts: 4
Hi,

I'm trying to code up something that could categorise hand strength on the flop including draws.

The motivation is to take the output of PioSolver report_IP_Full.csv files and run them through code to get Check and Bet Frequencies when you have different types of hands, such as for BUvsBB single raised pot how often does Pio think you should CBet TPTK or Pair+GS or OESD or Combo Draw. Basically get a type of decision tree which could form a heuristic for correct play which might be easily for a player to recall in realtime or could form the basis of an online assistance tool.

In terms of the programming I've looked up lot of hand evaluators but they are all concentrated on efficient assessment of who wins at showdown. I've yet to come across something that could take hole cards + Flop (or Turn) and categorise our hand a la Pio's "Range Explorer" or FlopZilla's Statistics.

I have made some naive code but it is pretty slow at the moment (running over +90k combos of starting hand + Flop is painful) and I can imagine someone much better than me at programming might have tackled this problem before and uploaded to GitHub.

Any help much appreciated! :D


Top
 Profile  
 
PostPosted: Sun Apr 14, 2019 8:14 am 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 589
I don't know anything about Pio or FlopZilla so I don't really understand the question. When I needed to evaluate strength on the flop at speed I pre-calculated all the hole vs hole strength matrices for all 1755 isomorphic flops and put them on disk. The occupy about 5Gb. You could either load each matrix as required or keep all in memory if memory constrained.


Top
 Profile  
 
PostPosted: Sun Apr 14, 2019 8:48 am 
Offline
New Member

Joined: Sun Apr 14, 2019 1:30 am
Posts: 4
spears wrote:
I don't know anything about Pio or FlopZilla so I don't really understand the question. When I needed to evaluate strength on the flop at speed I pre-calculated all the hole vs hole strength matrices for all 1755 isomorphic flops and put them on disk. The occupy about 5Gb. You could either load each matrix as required or keep all in memory if memory constrained.

PioSolver allows me to give it a range for me and my opponent pre-flop together with stacksize, pre-flop pot size and position. I can then ask PioSolver to solve the decision tree for a subset of flops which is representative of the full game:
https://www.piosolver.com/blogs/news/62725637-choosing-a-subset-of-flops-to-represent-the-whole-game

I ran BBvsBU in a single raised flop over 198 flops. PioSolver was then able to give me a CSV file which outputs the optimal decisions for each combination of hole cards and flop. With the ranges I selected this ended up being 92353 combinations for the in position player when facing a check on the flop.

Here is an example of the kind of information output into the csv:
    Flop, Hand, BET Pot%, BET 0.5Pot%, BET 0.25Pot%, CHECK%
    6s 4s 2d, 5c4c, 2.93, 5.90, 21.89, 69.28
The % numbers say how often you should perform said action to be balanced in your play.

I have 92k lines like this that I want to group into categories like made hands such as:
    Straight flush, Four of a kind, Full house, Flush, Straight, Three of a kind, Two pair, One pair
As well as drawing hands such as:
    Flush draw, Open Ended Straight Draw, GutShot, Combo draw, Pair + Draw, Overcards

Basically if I had a good function that I could pass my hole cards and the board which outputs what type of made hand/drawing hand you hold I would do multiple solves in PioSolver for different situations then perform slicing and analysis on the outputs based on these categories to infer the correct play, or generate some rules of thumb. All of this stuff is early days for me so I could for sure be thinking about this in the wrong way.


Top
 Profile  
 
PostPosted: Sun Apr 14, 2019 9:50 pm 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 589
- https://gist.github.com/sntran/8012387 shows a 5 card hand evaluator. You can definitely figure out the made hand categories from this. I don't know if you figure the draws or or not.
- You need a 5 card hand evaluator
- You might take a look at http://www.poker-ai.org/archive/www.pok ... ?f=3&t=353


Top
 Profile  
 
PostPosted: Sun Apr 14, 2019 10:07 pm 
Offline
New Member

Joined: Sun Apr 14, 2019 1:30 am
Posts: 4
Thanks for the link. I’ll check it out and see if I can modify it to get the draws.


Top
 Profile  
 
PostPosted: Tue Apr 16, 2019 12:36 am 
Offline
Senior Member

Joined: Fri Nov 25, 2016 10:42 pm
Posts: 122
spears wrote:
I don't know anything about Pio or FlopZilla so I don't really understand the question. When I needed to evaluate strength on the flop at speed I pre-calculated all the hole vs hole strength matrices for all 1755 isomorphic flops and put them on disk. The occupy about 5Gb. You could either load each matrix as required or keep all in memory if memory constrained.


Nice idea, thanks for sharing. Would you like to share your file where you calculated flop equity?


Top
 Profile  
 
PostPosted: Fri Aug 09, 2019 10:07 am 
Offline
New Member

Joined: Fri Aug 09, 2019 9:59 am
Posts: 5
spears wrote:
I don't know anything about Pio or FlopZilla so I don't really understand the question. When I needed to evaluate strength on the flop at speed I pre-calculated all the hole vs hole strength matrices for all 1755 isomorphic flops and put them on disk. The occupy about 5Gb. You could either load each matrix as required or keep all in memory if memory constrained.


Hi Spears,

Something I dont understand with isomorphic flop: all of them have at least one club, and none of them have 2 hearts or 2 diamonds, or 1 spade

So when you want to check equity with a given suited hand, how do you do? I mean:
- XhYh or XdYd : the best you will have is a backdoor flush draw
- XsYs : u will never have any kind of flush draw
- XcYc : you will always have at least backdoor flush draw or more. But in real world XcYc should hit some flops with no club, so no flush draw at all.

So equity of suited hands will always be underestimed or overestimed with this isomorphic flops. Could you explain me how to avoid this issue ?


Top
 Profile  
 
PostPosted: Fri Aug 09, 2019 10:14 am 
Offline
New Member

Joined: Fri Aug 09, 2019 9:59 am
Posts: 5
How I understand it:

If for example flop is 4s3s2s and I have AsKs, in order to work with isomoprhic flops, I should map my hand AsKs into AcKc and map the flop into the isomoprphic flop equivalent 4c3c2c, and so on ?


Top
 Profile  
 
PostPosted: Fri Aug 09, 2019 10:22 am 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 589
I found the suit mapping between the real flop and its isomorph and then applied that mapping to the hole cards. There are probably other ways to do it but they all use a similar principle.

Edit: Sorry my post crossed with your last one. I think you've got the idea.


Top
 Profile  
 
PostPosted: Fri Aug 09, 2019 10:51 am 
Offline
New Member

Joined: Fri Aug 09, 2019 9:59 am
Posts: 5
spears wrote:
I found the suit mapping between the real flop and its isomorph and then applied that mapping to the hole cards. There are probably other ways to do it but they all use a similar principle.

Edit: Sorry my post crossed with your last one. I think you've got the idea.


Ok i see the error I was doing when trying to calculate distribution equity of all hands for all isomorphic flops.

I was calculating equity for the 1326 two cards hands instead of merging them into the 169 canonical hands.

For example equity of AKs into 4c3c2c = 1 flush and 3 no flush draw at all, looks logical indeed

In real word then need only to map the true flop into the isomorphic and same for the 2 hole cards. However I read the colex paper, but it's a little hard to my understanding (knowing u need of course to have a good indexing system too if you want to save the 5 cards equity array and be able to check each array quickly then)


Top
 Profile  
 
PostPosted: Fri Aug 09, 2019 11:07 am 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 589
Quote:
However I read the colex paper, but it's a little hard to my understanding (knowing u need of course to have a good indexing system too if you want to save the 5 cards equity array and be able to check each array quickly then)


Sorry, I don't understand this. Maybe it doesn't matter.
- what's the colex paper?
- what's the 5 cards equity array? is it the hole v hole equity matrix for the flop?


Top
 Profile  
 
PostPosted: Fri Aug 09, 2019 11:10 am 
Offline
New Member

Joined: Fri Aug 09, 2019 9:59 am
Posts: 5
Regarding the initial question of Flop evalutation including draws, I was recently working on the same stuff. Trying to compute automatically the Upswing basic strategy which divides a given range into 4 regions C1/C2/C3/C4. According to this strategy, you will always bet with C1 and balance your best hands C1 with C3 (your best draws), check-call C2 (typically middle pair) and give up with C4. And so on for the turn and the river.

So given a range of preflop hands and a given flop, after having calculted the equities, I run Kmeans and split the range into 4 regions.
- top equity = C1 = bet
- 2nd region = C2 = check/call
- 3rd region = C3 = theorically best draws = bet
- bottom equities = C4 = check/fold or give up range

For example for AA-JJ,AKs-AJs,A5s-A4s,KQs,T9s,AKo-AQo (vs TT-66,AQs-ATs,KQs-KJs,QJs,JTs,T9s,AQo) into Jd9h7c, the betting range according Kmeans would be:
- JJ as C1
- AQ, AK and KQ as C3, aka bet as a draw (30-40% equity here)

But a lot of good hands as AJ AA KK QQ are included by Kmeans algo into C2 region so in this case it would be a check-call (or a call turn if hero is IP)... Hero betting range so appears to be a little bit unbalanced in favor of too many bluffs maybe.

Not sure it's a good approach but maybe it helps.


Last edited by Nemesis on Fri Aug 09, 2019 11:17 am, edited 1 time in total.

Top
 Profile  
 
PostPosted: Fri Aug 09, 2019 11:16 am 
Offline
New Member

Joined: Fri Aug 09, 2019 9:59 am
Posts: 5
spears wrote:
Quote:
However I read the colex paper, but it's a little hard to my understanding (knowing u need of course to have a good indexing system too if you want to save the 5 cards equity array and be able to check each array quickly then)


Sorry, I don't understand this. Maybe it doesn't matter.
- what's the colex paper?
- what's the 5 cards equity array? is it the hole v hole equity matrix for the flop?


Maybe i am wrong but if you want to precompute flop equities and then save then, you have to have an indexing system for the 3cards isomorphic flop + 2 hole isomorphic cards, no ?

For now, I dont find the original colex paper, but I think it has insipired the following paper mentioning the colex system : "Potential-aware automated abstraction of sequential games,
and holistic equilibrium analysis of Texas Hold’em poker"

Edit : I got it. Google "A Fast and Optimal Hand Isomorphism Algorithm" by Kevin Waugh. Indexing/Unindexing system for hand isomorphisms


Top
 Profile  
 
PostPosted: Fri Aug 09, 2019 11:32 am 
Offline
Site Admin
User avatar

Joined: Sun Feb 24, 2013 9:39 pm
Posts: 589
Quote:
Maybe i am wrong but if you want to precompute flop equities and then save then, you have to have an indexing system for the 3cards isomorphic flop + 2 hole isomorphic cards, no ?

I had an indexing system for isomorphic flops and another for hole cards. I just found a unique integer hash function for the flops and used a hash table. It's slow, but not as slow as reading the matrix off disk or multiplying the hand probabilities by the flop equity matrix (which is what I was doing) I guess if you are storing the equity of 5 card hands vs 5 card hands you have to do something smarter

Quote:
For now, I dont find the original colex paper, but I think it has insipired the following paper mentioning the colex system : "Potential-aware automated abstraction of sequential games,
and holistic equilibrium analysis of Texas Hold’em poker"


Ah The colexico- graphical index (Bollobás 1986) All that stuff makes my head hurt. I only read it as a last resort.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 14 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group