Open Side Menu Go to the Top
Register
Will Tipton Video Pack 2 - Solving Poker Will Tipton Video Pack 2 - Solving Poker

08-05-2014 , 05:45 PM
I don't know ArchLinux, (I'm on kubuntu) I saw you can install packages with Pacman, can you be more precise on the source repository for poker-eval and pypoker-eval and the version ? Also do you have to be careful on 32 vs 64 bits issues ?

Thnx for your quick replies !
Will Tipton Video Pack 2 - Solving Poker Quote
08-05-2014 , 06:14 PM
Quote:
Originally Posted by X0RR0
I don't know ArchLinux, (I'm on kubuntu) I saw you can install packages with Pacman, can you be more precise on the source repository for poker-eval and pypoker-eval and the version ? Also do you have to be careful on 32 vs 64 bits issues ?

Thnx for your quick replies !
The Arch packages are unlikely to work with kubuntu. Try searching your distribution's package repositories. I've not used kubuntu, but I imagine it's similar to ubuntu, where you'd do something like

Quote:
wtipton@wtipton:~$ apt-cache search poker-eval
libpoker-eval - poker hand evaluator library
libpoker-eval-dev - poker hand evaluator library development files
python-pypoker-eval - python interface to poker hand evaluator library development files
wtipton@wtipton:~$ sudo apt-get install libpoker-eval python-pypoker-eval
Will Tipton Video Pack 2 - Solving Poker Quote
08-05-2014 , 09:27 PM
Im struggling to get the right answer to the big T tree, been looking at this with no luck for ages now - does this bit of the code look ok?

Code:
def initialize(self):
        self.initializeHelper(0, 1.0, 1.0)
        
    # Inputs:
    #   iCurrDecPt: index of the current DP
    #   sbScale and bbScale: numbers between 0 and 1 -- the fraction of the starting ranges that the players
    #                        bring to this DP
    # Outputs: N/A 
    # Side-effects: set the range corresponding to the current DP, and call itself
    #               on all of the point's children (so as to do the right thing for them too).
    def initializeHelper(self, iCurrDecPt, sbScale, bbScale):
        children = self.tree.children[iCurrDecPt]
        numChildren = len(children)        
        if self.tree.decPts[iCurrDecPt].player == 'SB':
            sbScale /= numChildren
            for iChild in children:
                self.ranges[iChild].r = self.sbStartingRange.r.copy()
                self.ranges[iChild].scaleFracs(sbScale)
                self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
        elif self.tree.decPts[iCurrDecPt].player == 'BB':
            bbScale /= numChildren
            for iChild in children:
                self.ranges[iChild].r = self.bbStartingRange.r.copy()
                self.ranges[iChild].scaleFracs(bbScale)
                self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
        for iChild in children:
            self.initializeHelper(iChild, sbScale, bbScale)
I don't get any errors when I run all the code, but cant get the right EVs when I solve

Code:
soln2 = doFP(T, 300, sbStartingRange, bbStartingRange)
Will Tipton Video Pack 2 - Solving Poker Quote
08-05-2014 , 11:50 PM
Quote:
Originally Posted by tagWAG
Im struggling to get the right answer to the big T tree, been looking at this with no luck for ages now
Can you verify that you've addressed all the errata listed at the link in OP. Keep in mind that if you were affected by the last one when you generated some equity arrays, you'll need to delete and re-generate them after you fix the bug.

Quote:
does this bit of the code look ok?
What makes you think the issue might be with the initialize function?
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 08:04 AM
Quote:
Originally Posted by yaqh
Can you verify that you've addressed all the errata listed at the link in OP. Keep in mind that if you were affected by the last one when you generated some equity arrays, you'll need to delete and re-generate them after you fix the bug.
Yes, I've been through all the errata. I have also deleted and regenerated all the equity arrays.

Quote:
Originally Posted by yaqh
What makes you think the issue might be with the initialize function?
Just that this was one of the bits of code that you re-wrote during the video so I wanted to be sure I had it right. I have never programmed before doing this and Ive been back over the code so many times I am going a bit nuts.

My solution to the T game always starts incorrectly, and never converges to the right answer ->
Code:
soln2 = doFP(T, 300, sbStartingRange, bbStartingRange)
Code:
1
SB average EV: 9.0
BB average EV: 14.6661891117
2
SB average EV: 12.0
BB average EV: 16.4996418338
3
SB average EV: 13.5
BB average EV: 17.599713467
4
SB average EV: 14.4
BB average EV: 18.3330945559
5
SB average EV: 15.0
BB average EV: 18.8569381907
I have now spent many hours trying to solve this problem without success...
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 09:03 AM
Quote:
Originally Posted by yaqh
The Arch packages are unlikely to work with kubuntu. Try searching your distribution's package repositories. I've not used kubuntu, but I imagine it's similar to ubuntu, where you'd do something like
Quote:
wtipton@wtipton:~$ apt-cache search poker-eval
libpoker-eval - poker hand evaluator library
libpoker-eval-dev - poker hand evaluator library development files
python-pypoker-eval - python interface to poker hand evaluator library development files
wtipton@wtipton:~$ sudo apt-get install libpoker-eval python-pypoker-eval
Yes, that made it !
I first installed through pip install and got some sort of other pokereval.

Then installing through apt-get:
- python-scipy
- graphviz
- python-pydot
and it 's running.

For pydot I've had a strange error, the generated tree starts with:
Code:
digraph G {
node0 [label=0: SB (0.5,1.0)];
. . .
So I had to add quotes in the code around the label string ""
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 10:06 AM
@tagWAG

Maybe post some of the anormal ranges you get as it provides much information.

I had an annoying typo which took me a day to find, I called some recursive functions passing iDecPt instead of iChild... better check all those.
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 10:49 AM
s/anormal/abnormal

You could also run it against the shove/fold game for which you can compare ranges:

Code:
S = 10
preflopEquityArray = EquityArray([255,255,255,255,255])
spoint0=DecPt('SB',0.5,1.0,preflopEquityArray,'')
spoint1=DecPt('Leaf',0.5,1.0,preflopEquityArray,'fold')
spoint2=DecPt('BB',S,1.0,preflopEquityArray,'bet')
spoint3=DecPt('Leaf',S,1.0,preflopEquityArray,'fold')
spoint4=DecPt('Leaf',S,S,preflopEquityArray,'call')


FShoveTree=Tree(S, spoint0)
FShoveTree.addDecPt(spoint1,spoint0)
FShoveTree.addDecPt(spoint2,spoint0)
FShoveTree.addDecPt(spoint3,spoint2)
FShoveTree.addDecPt(spoint4,spoint2)

FShoveTree
Another trick I used to debug, was to check the evs for a specific hand I wanted him to fold, by adding in every function a test:
Code:
if i==0 and j==2
     print "Function nameX ", strats.evs[hero][iDecPt][i][j]
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 11:20 AM
Quote:
Originally Posted by X0RR0
@tagWAG

Maybe post some of the anormal ranges you get as it provides much information.
Happy to show all the ranges I get, but how can I post these - is there an easy way?

Thanks
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 11:26 AM
Quote:
Originally Posted by X0RR0
You could also run it against the shove/fold game for which you can compare ranges:
my shove/fold game works perfectly if that helps to narrow things down?
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 11:33 AM
Quote:
Originally Posted by tagWAG
Happy to show all the ranges I get, but how can I post these - is there an easy way?

Thanks
Tbh, I doubt that there will be too much we can see by seeing the resulting ranges.

Try to find the "simplest" example of incorrect behavior you can. (By simplest, I mean for example:
- small inputs (e.g. use a small decision tree)
- likely to be as close as possible to the problem (e.g., look at the EVs, not the ranges that come from taking the maximum over the EVs and then doing a bunch of mixing)
) and then follow the procedure of post #16 in this thread.

So, to try to find a good spot to start, you might fix Villain's strat, run setMaxExplEVs once manually (i.e. not using our FP algorithm) and then start checking EVs. Pick one particular hand combo, compute what the EVs should be by hand, and compare that to what your code generates.

Quote:
Originally Posted by tagWAG
my shove/fold game works perfectly if that helps to narrow things down?
If by shove/fold you mean minraise/shove, then the only code I can think of that's exercised by the postflop game is the equity array generation and the setmaxExplEVsAtNatureDP function.
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 11:36 AM
Quote:
Originally Posted by X0RR0
For pydot I've had a strange error, the generated tree starts with:
Code:
digraph G {
node0 [label=0: SB (0.5,1.0)];
. . .
So I had to add quotes in the code around the label string ""
Glad you were able to get things working on Linux. Regarding this issue, I'm not quite sure what you mean, but it sounds like you've got it sorted?
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 11:40 AM
double checking my solution to FShoveTree

Code:
solnFShove = doFP(FShoveTree, 100)
Code:
1
SB average EV: 10.5589697294
BB average EV: 10.3387670096

.....

99
SB average EV: 9.96729729608
BB average EV: 10.0531469191
100
SB average EV: 9.96717269435
BB average EV: 10.0530698658
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 12:49 PM
Thank you yaqh, thank you X0RR0!!

Wonderful, I found the bug!

Quote:
Originally Posted by X0RR0
@tagWAG

I had an annoying typo which took me a day to find, I called some recursive functions passing iDecPt instead of iChild... better check all those.
Exactly this was my bug, I had iDecPt instead of iChild in setMaxExplEVsAtNatureDP

So fixing this:
Code:
strats.evs[hero][iDecPt][i][j] += strats.evs[hero][iDecPt][i][j] * (comboCounts[iChild] / comboSum)
To this:
Code:
strats.evs[hero][iDecPt][i][j] += strats.evs[hero][iChild][i][j] * (comboCounts[iChild] / comboSum)
solved everything... And now all the ev results are good
Code:
soln2 = doFP(T, 300, sbStartingRange, bbStartingRange)
Code:
299
SB average EV: 19.0037496863
BB average EV: 21.0410550585
300
SB average EV: 19.003628312
BB average EV: 21.041093412
Thanks for helping, this was really frustrating to a non coder like me, I couldn't have understood the problem without your help.
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 01:17 PM
Quote:
Originally Posted by yaqh
Cool stuff. I like how you show equity in the pot in terms of BBs rather than a fraction.
Thanks, I originally had it as a fraction but felt like it made the graph harder to read. Also more clear now what impact the betting rounds have on EVs relative to a no betting game.

Quote:
Regarding CFs, it's the fraction of the pot a hand figures to capture. So, I think you want (solid blue line - player chips in stack) / (player chips in pot). The curve should essentially be parallel to the EV curve, just shifted and rescaled.
Ah ok, so if I have 20 chips and there are 5 in the pot and my EV for the hand is 25 chips, then CF=1 (ie I average winning the whole pot)? I was trying to look at what % of our equity do we realize, so in the same spot if we have 20 chips and our hand has 50% in a 5 chip pot but our EV is 25 chips, then we've captured 2x our equity (we average winning the whole pot, 2x50%=100%) which as I write it out is much more confusing than your way. Thanks for the clarification!
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 01:21 PM
Quote:
Originally Posted by yaqh
I wasn't able to find the course you link to, but here's something that looks similar. I haven't watched these videos, but I've seen a lot of other stuff on MIT's OCW site, and it's generally very good.

http://ocw.mit.edu/courses/electrica...ction-to-6.00/

Will
I think the course he'd linked is no longer open, I was able to get in to audit it a couple weeks ago but can't find it now. I'm almost done the course and think it was pretty worthwhile. If anyone's interested there's another one starting up at the end of the month - it's free although I think there's an option to pay and then get credit somehow? Not sure, you can definitely do it for free though.

Link: MIT CS 6.00.1x
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 06:08 PM
Hey Will,

how much knowledge do you think is necessary to be able to write this kind of program on your own, with no guidance whatsoever? I'm going to start my third year of CS, and I definitely wouldn't be able to think of every function like in the vid. I'm asking only about function/class definitions, because python after using c++ (we only do c++) is ridiculously easy to operate.

Another question if you have time: How can one learn about code optimization on his own? Board files taking up xxMB of space seem extremely large, also some of the calculations in the video would probably use some optimization.
Btw. First book said you're Mathematics graduate, but then you take a job at Google. So you also did CS?

PS. I asked a question in the vol. 2 thread a while ago. Did you choose to ignore it, or you haven't been looking in that thread?
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 08:00 PM
klondi, you're missing a closed bracket on the previous line:
self.setFrac((pe.string2card([rank1+suits[i], rank2+suits[j]]), value))
edit: or maybe you just put an extra bracket after setFrac, either way you have a mismatched # of open and closed brackets.

annoying because the error is actually on the line previous to the one they show sometimes, I wasted a lot of time finding one of those in my code.
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 08:03 PM
You're missing an open bracket, not a closed one, right before elif == 4.

Code:
(pe.string2card([rank1+suits[i], rank2+suits[j]]))
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 09:58 PM
Quote:
Originally Posted by lestro
You're missing an open bracket, not a closed one, right before elif == 4.

Code:
(pe.string2card([rank1+suits[i], rank2+suits[j]]))
how is that an open bracket? ( [ { = open, ) ] } = closed...right?

edit: and the post we're discussing is gone
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 11:11 PM
Quote:
Originally Posted by stevepa
how is that an open bracket? ( [ { = open, ) ] } = closed...right?

edit: and the post we're discussing is gone
Yeah dumb me haha, he was missing a parenthesis not a bracket.

[ ] = square bracket
( ) = parenthesis
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 11:17 PM
Quote:
Originally Posted by stevepa
Quote:
Regarding CFs, it's the fraction of the pot a hand figures to capture. So, I think you want (solid blue line - player chips in stack) / (player chips in pot). The curve should essentially be parallel to the EV curve, just shifted and rescaled.
Ah ok, so if I have 20 chips and there are 5 in the pot and my EV for the hand is 25 chips, then CF=1 (ie I average winning the whole pot)? I was trying to look at what % of our equity do we realize, so in the same spot if we have 20 chips and our hand has 50% in a 5 chip pot but our EV is 25 chips, then we've captured 2x our equity (we average winning the whole pot, 2x50%=100%) which as I write it out is much more confusing than your way. Thanks for the clarification!
Ah ok, yea I actually played around with the "% of our equity we realize" approach for a while. The weird thing about that is that it gets really noisy and hard to make much sense of for low-equity hands. In the most extreme case, you have a complete air hand (0 equity) that manages to win a little of the pot on avg with a bluff or w/e, and then the % of your equity realized is (a little)/0 = infinity. Additionally, if you want to do an EV calc using that number, you pretty much always start out by multiplying by your equity to get a CF anyway...
Will Tipton Video Pack 2 - Solving Poker Quote
08-06-2014 , 11:38 PM
Quote:
Originally Posted by lestro
Hey Will,

how much knowledge do you think is necessary to be able to write this kind of program on your own, with no guidance whatsoever? I'm going to start my third year of CS, and I definitely wouldn't be able to think of every function like in the vid. I'm asking only about function/class definitions, because python after using c++ (we only do c++) is ridiculously easy to operate.
Well if it looked easy on video, it's because I planned ahead of time. Also I've written similar programs a few times previously. Certainly things didn't go in such a linear fashion the first time. You make one pass at things, then you decide you need some more methods, or you should have designed something or other differently, etc. But yea, there's pretty much no way I could have made a series like this using C++.

Quote:
Originally Posted by lestro
Another question if you have time: How can one learn about code optimization on his own? Board files taking up xxMB of space seem extremely large, also some of the calculations in the video would probably use some optimization.
Optimization isn't something I know a ton about. I guess there are different kinds of optimization corresponding to the different resources you might want to minimize the use of. For RAM, I can't really think of anything more specific than to say -- figure out what part of your program is using a lot of memory (and that's pretty obvious in our case) and then try to make that part use less (and 3 or 4 ways of doing that are described above).

Quote:
Btw. First book said you're Mathematics graduate, but then you take a job at Google. So you also did CS?
Um, well in college I double majored in physics and cs/math joint. (I don't think it's common, but my school offered a cs/math joint major which is one degree where you do some cs and some math and some stuff on the border between them.) And then my graduate degrees are in materials science, but my research was essentially all computational physics.

I forget what it said in my author biography blurb or whatnot, but I usually simplify the story unless people really want to know.

Quote:
PS. I asked a question in the vol. 2 thread a while ago. Did you choose to ignore it, or you haven't been looking in that thread?
I've been trying to answer questions in order. If I've responded to a more recent question since you asked, then I ignored it, unintentionally, and please remind me in that thread. Otherwise, I just haven't gotten to it yet. I'm a little bdhind.
Will Tipton Video Pack 2 - Solving Poker Quote
08-07-2014 , 12:29 AM
Quote:
Originally Posted by yaqh
I've been trying to answer questions in order. If I've responded to a more recent question since you asked, then I ignored it, unintentionally, and please remind me in that thread. Otherwise, I just haven't gotten to it yet. I'm a little bdhind.
Thanks so much for your time.

Curious if you anticipated so much "post-production" work because with 3 active threads on 2p2 only, that's a huge amount of work.
Will Tipton Video Pack 2 - Solving Poker Quote
08-07-2014 , 04:55 AM
Quote:
Originally Posted by stevepa
klondi, you're missing a closed bracket on the previous line:
self.setFrac((pe.string2card([rank1+suits[i], rank2+suits[j]]), value))
edit: or maybe you just put an extra bracket after setFrac, either way you have a mismatched # of open and closed brackets.

annoying because the error is actually on the line previous to the one they show sometimes, I wasted a lot of time finding one of those in my code.
Hi there thanks for your help.

I deleted my post because I was able to find the error on my own right after I posted here.

And you are right. I had a parenthesis to many in the previous line.
Will Tipton Video Pack 2 - Solving Poker Quote

      
m