Skip to forum
Midlife Crisis? Wha...
 
Notifications
Clear all

Midlife Crisis? What Midlife Crisis?

8,661 Posts
251 Users
37 Reactions
787.6 K Views
jbpatzer
Joined: 23.11.2009

I feel the urge to update.....

I haven't been playing at all because this month I have decided to use my evenings on poker maths. I want to write some code that, for a given flop and pair of hand ranges, can calculate the equilibrium strategy in a HU NLHE pot. This is, ofc, what GTORangeBuilder does for a given flop, turn and river, but I decided to try to be more ambitious. In order to do this I've been learning about CounterFactual Regret Minimization (CFRM), which seems to be what all the cool kids use to solve problems like this. I mentioned this to MisClick, and she felt that minimizing regret would be a good idea, although she may have been thinking of something a bit more existential than 'I played Rock, he played Paper, I regret not playing Scissors'.

It's taken me a while to get my head around coding up the wretched thing (e.g. CFRM tutorial at http://modelai.gettysburg.edu/2013/cfr/cfr.pdf , which is useful, but confusing), so I've been building up my experience by starting with simple games: Rock Paper Scissors, and then the AKQ game, and finally the AKQ game betting structure but with arbitrary decks for each player, e.g. if AKQ = [3 2 1], I can do the more general [a1 b1.....] against [a2 b2......] game, taking card removal into account.

My next step is to work out how to code up more complex betting structures, and then change from the showdown being I have 3, you have 2, I win, to the rankings for Holdem hands. Other issues that need to be addressed, and for which I have some ideas, are bucketing of hands (e.g. 7h6c = 7d6s on a rainbow flop) and what betsizes to allow (1/3 pot, 2/3 pot, pot and 4/3 pot would be nice, but I'm not sure what's feasible yet). If I could write something that does the analysis in less than a day of computing time, I'd be a happy bunny.

I'm writing everything from scratch in MATLAB, and having frustrating fun.


Reply
Quote
EmanuelC16
Joined: 02.01.2010

I mean it in the best of ways:


Reply
Quote
jbpatzer
Joined: 23.11.2009

Of course I'm a nerd.

I'm reminded of a conversation I recently had with mrsjb as I stepped out of the door on the way to work.

Mrsjb: Your hair looks too nerdy! *tries to scramble my hair with her hand*
Me: I'm a maths professor, not a member of One Direction. What sort of hair do you expect me to have??
Mrsjb: *falls unexpectedly silent*
Me: *goes to work, unsure whether the silence is the sound of enlightenment or disappointment*


Reply
Quote
jules97
Joined: 10.06.2012

Right sooo....

Can you explain, like you would to a not so bright 10 year old, the difference between fictitious play and CFRM?

Does fictitious play assume an opponent's strategy is stationary, while CFRM has some tricky techniques for predicting an opponents changes to strategy?

All I remember of matlab is trying and failing to put in answers to tests. Answers that were right but matlab marked wrong. fuck matlab.


Reply
Quote
jbpatzer
Joined: 23.11.2009

Originally posted by jules97
Right sooo....

Can you explain, like you would to a not so bright 10 year old, the difference between fictitious play and CFRM?

Does fictitious play assume an opponent's strategy is stationary, while CFRM has some tricky techniques for predicting an opponents changes to strategy?

All I remember of matlab is trying and failing to put in answers to tests. Answers that were right but matlab marked wrong. fuck matlab.

In fictitious play you start with a guesstimate of the equilibrium strategies and play them off against each other, making small adjustments to the strategy that increase each player's EV after each iteration. I don't know whether there's much theory on it, and I'm not sure whether there's any guarantee of convergence (I expect there isn't, but I could easily be wrong).

In regret matching, for example for RPS, you start from any old mixed strategy pair, and pick a strategy for each player. You then calculate the regrets. For example, if player 1 plays rock and player two plays paper, he loses $1, whilst if he'd played paper he'd have lost $0 and for scissors won $1. He therefore regrets not playing scissors by $2 and paper by $1. His regret profile for (R,P,S) is therefore (0,1,2). We do this at every iteration for each player and accumulate all the regrets. Normalise this so that it sums to one and use this as the players' strategies. For example, from (0,1,2) we get the strategy profile (0,1/3,2/3), so that on the next iteration he plays paper 1/3 of the time and scissors 2/3 of the time. If you do this a gazillion times, the average strategy converges to the Nash equilibrium. Guaranteed. Fo sho.

CFRM is regret matching for extensive form games (i.e. games with a game tree). The tricky part is that we have to do regret matching for every information set (i.e. for the AKQ game, you accumulates regrets for player two, who has to decide whether or not to bet A, K or Q , and for player 1, who has to decide whether or not to call with A, K or Q) and if one of the information sets is followed by another, it's not clear how to calculate the regrets because the value of one of its nodes isn't immediately obvious. CFRM gives you a reasonably straightforward way to do this, which basically involves starting at the leaves of the tree and working upwards, calculating values by assuming that the player who's doing the regretting played to get to that information set. It's this bit that's rather confusing. It seems that you can code this up using a recursive function, but I'm struggling to follow the logic at the moment.

From what I've seen in the simple problems that I've done so far, one great feature of CFRM is that components of the equilibrium strategy that are not mixed (e.g. in the AKQ game you should bet an A every time) converge more rapidly than parts that are mixed at equilibrium (e.g. in the AKQ game, how often to bluff with a Q). In Holdem, I'd expect that most of the interesting bits of an equilibrium strategy won't be mixed (e.g. if the equilibrium is to call with some fraction of your best hands, most hands in the calling range will call every time, with some borderline hands calling some fraction of the time).

.....and don't diss MATLAB....Philistine! :f_mad:


Reply
Quote
jules97
Joined: 10.06.2012

Thanks for taking the time to type that out :f_love:

I've started to read Will Tiptons books, which is a similar sensation to getting hit in the head with a brick. Repeatedly. You would probably like them. :f_o:
I 'think' early on, about 30 to 40 pages into the first one, he goes over an iteration process similar to what you described of CFRM.
They're called heads up poker books, but that must have been a marketing ploy by the publisher. Maths of poker, the sequel would be more appropriate.

So many things, such limited intellect... :facepalm:


Reply
Quote
jbpatzer
Joined: 23.11.2009

Originally posted by jules97

I've started to read Will Tiptons books, which is a similar sensation to getting hit in the head with a brick. Repeatedly. You would probably like them. :f_o:
I 'think' early on, about 30 to 40 pages into the first one, he goes over an iteration process similar to what you described of CFRM.

I've read about the first third of that book. That iteration process is actually the basis of fictitious play. Nothing like CFRM at all I'm afraid. _evil:


Reply
Quote
jules97
Joined: 10.06.2012

lol :f_cool:

Perhaps 10 year old was overshooting.


Reply
Quote
jbpatzer
Joined: 23.11.2009

Originally posted by jules97
lol :f_cool:

Perhaps 10 year old was overshooting.

These things take a while to get your head around.

Still making progress with my code. I now have it implemented using a recursive function, which is rather cool, and have also solved a two street game, just to check I know how to do that. At the moment I'm coding up the structure of the game tree by hand, but the next step is to automate this. If I want to allow raises and reraises of, say 1/3, 2/3, 1 and 4/3 times pot at each round, I don't want to be doing it line by line. Once I have that, I'll have a code that can solve, up to the discrete betsizes, the no limit AKQ game.....played in casinos all around the world of course. Then I have to switch to Holdem....sigh. :f_eek:


Reply
Quote
NutzAreOk
Joined: 28.01.2011

I started to read your blog from the beginning but then I noticed there is over 400 pages. So I was forced to skip most of the pages. Great blog though. :)


Reply
Quote
jbpatzer
Joined: 23.11.2009

Originally posted by NutzAreOk
I started to read your blog from the beginning but then I noticed there is over 400 pages. So I was forced to skip most of the pages. Great blog though. :)

That's four years of effort that you're skipping over there. The cheapest cure for insomnia on the market.

I'm off to sit on the stage and clap for an hour at graduation. Fml.


Reply
Quote
gadget51
Joined: 23.06.2008

You just make me laugh.

When I graduated I was last up, right after my genius friend getting his Phd. I bowed to everybody I was so pleased, even the audience. I thought they might be appreciative of that.

Will you be the one having fun trying to pronounce the names? :tongue:


Reply
Quote
jbpatzer
Joined: 23.11.2009

Originally posted by gadget51
You just make me laugh.

When I graduated I was last up, right after my genius friend getting his Phd. I bowed to everybody I was so pleased, even the audience. I thought they might be appreciative of that.

Will you be the one having fun trying to pronounce the names? :tongue:

Nope. Just clapping. Clapping. More clapping.....


Reply
Quote
EmanuelC16
Joined: 02.01.2010

Originally posted by jbpatzer

Originally posted by gadget51
You just make me laugh.

When I graduated I was last up, right after my genius friend getting his Phd. I bowed to everybody I was so pleased, even the audience. I thought they might be appreciative of that.

Will you be the one having fun trying to pronounce the names? :tongue:

Nope. Just clapping. Clapping. More clapping.....

Try this instead of clapping.


Reply
Quote
mineriva
Joined: 30.04.2008

and taking pics and video. it is obligatory.


Reply
Quote
jbpatzer
Joined: 23.11.2009

Originally posted by mineriva
and taking pics and video. it is obligatory.

Vid will be online soon. You can watch last year's already.


Reply
Quote
jbpatzer
Joined: 23.11.2009

After my exciting day of clapping, I had an exciting evening of coding. I was focussing on automatically generating the game trees that I need tonight, and I think I cracked it.

Here's a couple of examples. Firstly, in a 3bet pot (SPR = 6) with only potsized raises allowed, the game tree has 110 nodes, of which 42 are information sets (basically points where a player has to make a decision).

I think you can just about see what's going on here. Vertical lines go from a flop, turn or river node to a decision node. The other branches depend on decisions to fold, call or raise. The long lines that go to the bottom of the picture are folds. In this picture it's simple enough that lines that go southwest are checks or folds and those that go southeast are raises or calls. I have high hopes of being able to solve games on this tree.

In contrast, in a single raised pot (SPR = 12) with raises of 1/3, 2/3, 1 and 4/3 pot allowed we get 12202 nodes and 4332 information sets.

Hmmmm. Not so sure about that one.... :f_o:

Remember everybody, the game that you know and love is played on this sort of tree....and this is only postflop.... :f_eek:


Reply
Quote
NutzAreOk
Joined: 28.01.2011

This is confusing. :f_eek:


Reply
Quote
jules97
Joined: 10.06.2012

Originally posted by jbpatzer
These things take a while to get your head around.

Ok, does this sound any better?

Fictitious play is calculating the 'EV' of 1 run though of the game for player 1 and then player 2 and then repeating this more run throughs.

CFRM is calculating the strategy payoffs of each decision, in each node for each player and then repeating this for more run throughs.

Nice job with your code. Those node trees are looking sweet! :) Well... maybe not the single raised pot one...


Reply
Quote
Naidonis
Joined: 05.01.2013

Originally posted by jbpatzer
... beautiful trees ...

wow this is cool stuff. How long did it take to script this?


Reply
Quote