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

08-07-2014 , 11:05 AM
Quote:
Originally Posted by lestro
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.
It's ok. I learn a lot from it.
Will Tipton Video Pack 2 - Solving Poker Quote
08-07-2014 , 11:07 AM
Quote:
Originally Posted by KnutXX
Hello Ladies and Gentlemen,

running the
Code:
spair = StrategyPair(T)
spair.dump()
command in the Strategy Pair Video, I got the following error message:

Code:
ZeroDivisionError                         Traceback (most recent call last)

<..snip..>

<ipython-input-163-d6ee164e9276> in initializeHelper(self, iCurrDecPt, sbScale, bbScale)
    118                 self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
    119         elif self.tree.decPts[iCurrDecPt].player == 'BB':
--> 120             bbScale /= numChildren
    121             for iChild in children:
    122                 self.ranges[iChild].r = self.bbStartingRange.r.copy()

ZeroDivisionError: float division by zero
Here's my code -- I checked it multiple times to exclude typing errors:
Hi KnutXX,

Please don't post large sections of the source code, especially in spots like this where its relationship to your bug is dubious. Please follow the procedure in post #16 to both narrow down the location of the bug and to provide useful debugging info.

In this case, the error message seems to tell the story. It looks like you have a decision point that's owned by the BB and which has 0 children. When should that be true?
Will Tipton Video Pack 2 - Solving Poker Quote
08-07-2014 , 01:25 PM
Quote:
Originally Posted by yaqh
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...
makes sense, thanks for the explanation
Will Tipton Video Pack 2 - Solving Poker Quote
08-07-2014 , 06:07 PM
Quote:
Originally Posted by yaqh

In this case, the error message seems to tell the story. It looks like you have a decision point that's owned by the BB and which has 0 children. When should that be true?
That's only possible at showdown after the BB either called or folded if I got your question correctly

Debugging process:
1. This function
Code:
spair = StrategyPair(T)
spair.dump()
is printing the following error
Code:
ZeroDivisionError                         Traceback (most recent call last)
<ipython-input-42-92ff19a78a1b> in <module>()
----> 1 spair = StrategyPair(T)
      2 spair.dump()

<ipython-input-40-d6ee164e9276> in __init__(self, tree, sbStartingRange, bbStartingRange)
     36             self.bbStartingRange = Range(1.0)
     37         # initialize the ranges
---> 38         self.initialize()
     39     # Inputs:
     40     #   player: "SB" or "BB"

<ipython-input-40-d6ee164e9276> in initialize(self)
     99     #               their starting ranges and randomly (uniformly) select an action at each dec pt
    100     def initialize(self):
--> 101         self.initializeHelper(0, 1.0, 1.0)
    102 
    103     # Inputs:

<ipython-input-40-d6ee164e9276> in initializeHelper(self, iCurrDecPt, sbScale, bbScale)
    124                 self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
    125         for iChild in children:
--> 126             self.initializeHelper(iChild, sbScale, bbScale)
    127 

<ipython-input-40-d6ee164e9276> in initializeHelper(self, iCurrDecPt, sbScale, bbScale)
    124                 self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
    125         for iChild in children:
--> 126             self.initializeHelper(iChild, sbScale, bbScale)
    127 

<ipython-input-40-d6ee164e9276> in initializeHelper(self, iCurrDecPt, sbScale, bbScale)
    124                 self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
    125         for iChild in children:
--> 126             self.initializeHelper(iChild, sbScale, bbScale)
    127 

<ipython-input-40-d6ee164e9276> in initializeHelper(self, iCurrDecPt, sbScale, bbScale)
    124                 self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
    125         for iChild in children:
--> 126             self.initializeHelper(iChild, sbScale, bbScale)
    127 

<ipython-input-40-d6ee164e9276> in initializeHelper(self, iCurrDecPt, sbScale, bbScale)
    124                 self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
    125         for iChild in children:
--> 126             self.initializeHelper(iChild, sbScale, bbScale)
    127 

<ipython-input-40-d6ee164e9276> in initializeHelper(self, iCurrDecPt, sbScale, bbScale)
    118                 self.ranges[iChild].removeHandsWithConflicts(self.tree.decPts[iCurrDecPt].eArray.board)
    119         elif self.tree.decPts[iCurrDecPt].player == 'BB':
--> 120             bbScale /= numChildren
    121             for iChild in children:
    122                 self.ranges[iChild].r = self.bbStartingRange.r.copy()

ZeroDivisionError: float division by zero
The answer should be the default strategy pair for T (AKQxx board).
2. no idea about the inputs, but I'm sure my inputs are wrong

Thanks in advance

Last edited by KnutXX; 08-07-2014 at 06:32 PM.
Will Tipton Video Pack 2 - Solving Poker Quote
08-07-2014 , 07:53 PM
It's telling you there's a ZeroDivisionError in the line:
Code:
 
elif self.tree.decPts[iCurrDecPt].player == 'BB':
     bbScale /= numChildren
At some bb decision point there are 0 children (ie it's a leaf) and so bbScale /= numChildren gives an error. Your error is probably in the initializeHelper function (it tells you that's where the above line of code is), look there and try to figure out what's happening.
Will Tipton Video Pack 2 - Solving Poker Quote
08-07-2014 , 08:22 PM
Iwe run into another problem with the range class.

Seems same as user Mrpete had previously.

When i run the Range class block there are no errors.
but when i try to display bob i get this

Code:
E:\Programmer\Ipython\lib\site-packages\IPython\core\formatters.py:239: FormatterWarning: Exception in image/svg+xml formatter: unsupported operand type(s) for +=: 'float' and 'NoneType'
  FormatterWarning,
<__main__.Range instance at 0x05B480A8>

I tryed to debug by running this block

Code:
bob._repr_svg_()
Wich result in the same problem as Mrpete had ( i dont know if his problems was solved ?)

Code:
TypeError                                 Traceback (most recent call last)
<ipython-input-50-301a190942bb> in <module>()
----> 1 bob._repr_svg_()

<ipython-input-48-bd9a4511d63f> in _repr_svg_(self)
    131         for i in range(numRanks):
    132             for j in range(numRanks):
--> 133                 frac = self.getAmbigFrac(ranks[i], ranks[j], i > j)
    134                 hexcolor = '#%02x%02x%02x' % (255*(1-frac), 255, 255*(1-frac))
    135                 result += '<rect x="' + str(i*20) + '" y="' + str(j*20) + '" width="20" height="20" fill="'                        + hexcolor+'"></rect>'

<ipython-input-48-bd9a4511d63f> in getAmbigFrac(self, rank1, rank2, suited)
    124                     continue
    125                 nHand += 1 # short for nHand = nHand +1
--> 126                 nFrac += self.getFrac(pe.string2card([card1,card2]))
    127         return nFrac / nHand
    128 

TypeError: unsupported operand type(s) for +=: 'float' and 'NoneType'
Been staring at the code for like 2 hours without any progress.

Is it posibel to get a litle more help, becase im sorta hit a dead end here.

Last edited by klondi; 08-07-2014 at 08:36 PM.
Will Tipton Video Pack 2 - Solving Poker Quote
08-08-2014 , 03:38 AM
Quote:
Originally Posted by stevepa
It's telling you there's a ZeroDivisionError in the line:
Code:
 
elif self.tree.decPts[iCurrDecPt].player == 'BB':
     bbScale /= numChildren
At some bb decision point there are 0 children (ie it's a leaf) and so bbScale /= numChildren gives an error. Your error is probably in the initializeHelper function (it tells you that's where the above line of code is), look there and try to figure out what's happening.
didn't change anything, run all cells today again and it suddenly works. weird.
Will Tipton Video Pack 2 - Solving Poker Quote
08-08-2014 , 03:40 AM
You must have left out a specific cell last time while running the code.
Will Tipton Video Pack 2 - Solving Poker Quote
08-08-2014 , 12:14 PM
Trying to work with reduced equityArrays of size numHands and reduced Ranges of same size, the function getEquityVSRange does not seem to work well anymore.

reducedEquity = ea.equityArray[index] # slice corresponding to Hand pointed by index in [0, numHands[
# After zeroing hands with conflicts in Villain's range, I do :
return sum( np.multiply (reducedEquity, reducedRange)) / sum(reducedRange)

Is there an obvious reason I miss for this not to be correct and underestimated?
Will Tipton Video Pack 2 - Solving Poker Quote
08-08-2014 , 12:48 PM
@X0RR0, edit of my post after 30 minutes impossible

I got it! I had missed some hands in zeroHandswithConflicts, so yes it works.
Will Tipton Video Pack 2 - Solving Poker Quote
08-09-2014 , 04:12 AM
Quote:
Originally Posted by yaqh
It looks like you have a decision point that's owned by the BB and which has 0 children. When should that be true?
Quote:
Originally Posted by KnutXX
That's only possible at showdown after the BB either called or folded if I got your question correctly
Well, it was sort of a trick question -- it should never be true! If it's a BB decision point, that means it's a spot where the BB has a decision to make, and such a point necessarily has to have some children corresponding to the BB's choices. Points at the end of the hand, where there are no more decisions to be made, have type Leaf.

So, one likely explanation for your error is that you built an invalid game tree, one with a point which had type BB when it should have been Leaf.

Quote:
Originally Posted by KnutXX
2. no idea about the inputs, but I'm sure my inputs are wrong

Thanks in advance
The simplest way to examine the inputs is to just print them out at the beginning of the function.
Will Tipton Video Pack 2 - Solving Poker Quote
08-09-2014 , 05:12 AM
Quote:
Originally Posted by yaqh
Ah, I'd forgotten about card2string and string2card (you say "too many things", but I can't think of any others?) Anyhow, those are easy. Since we have the cards array (cards = ['2h', '3h', ...], we can convert string to number with, e.g.
Code:
print cards.index('3s')
and number to string with
Code:
print cards[40]
.
Put something like this in a for loop to convert a whole array at once like c2s and s2c do, and remember to special case the "empty" card, '__' or 255.



Python is garbage collected language which means that you don't explicitly free memory once you're done with it. The garbage collector kicks in every once in a while and looks for stuff no longer being used and frees it. Our EAs are never available to be freed like this, since we keep references to them in each decision point, so they're never "no longer being used".

You could not store the EAs in decision points, and instead just store the board. Then, you'd have to pull the EA from disk every time you want to do an equity calculation. (That is, whenever you get to the parts of setmaxExplEVsAtLeaf corresponding to a showdown or call of an all-in.) So, that seems like a small change -- give it a try? I'm interested to know how much of a speed penalty you incur...
First I tried not storing the EAs in decision points, but it seemed to make the program run ~100x slower. It's possible I messed up the code somewhere of course.

After that I decided to try 64-bit again, you were right, as soon as I realized there was pokereval stuff used in the code I gave up, but it was just string2card and card2string, and it was pretty easy to write functions to replace them. It turns out that with 64-bit my computer has enough memory to solve turn spots. It took quite a while to finish, partly because I used 2 betsizes. Unfortunately the results are quite hard to read, I guess I'll have to work on some ways of presenting the results easier.
Will Tipton Video Pack 2 - Solving Poker Quote
08-09-2014 , 03:43 PM
Quote:
Originally Posted by 307th
First I tried not storing the EAs in decision points, but it seemed to make the program run ~100x slower. It's possible I messed up the code somewhere of course.
That definitely sounds plausible. Harddrives are slow.

Quote:
Originally Posted by 307th
After that I decided to try 64-bit again, you were right, as soon as I realized there was pokereval stuff used in the code I gave up, but it was just string2card and card2string, and it was pretty easy to write functions to replace them. It turns out that with 64-bit my computer has enough memory to solve turn spots. It took quite a while to finish, partly because I used 2 betsizes. Unfortunately the results are quite hard to read, I guess I'll have to work on some ways of presenting the results easier.
Cool, sounds good. It's still probably worth making sure you don't load more than one copy of any particular EA into memory.
Will Tipton Video Pack 2 - Solving Poker Quote
08-10-2014 , 01:24 PM
Quote:
Originally Posted by 307th
It turns out that with 64-bit my computer has enough memory to solve turn spots. It took quite a while to finish, partly because I used 2 betsizes.
Just curious, how many decision points in your game tree and how big is the game? Did you write your own tree builder?
Will Tipton Video Pack 2 - Solving Poker Quote
08-11-2014 , 03:13 AM
Just finished the video series and wanted to apply what we have learned to Example 1 on p.196 in v1. I created the game tree but I was wondering if we start on the flop or assign river ranges and start on the river.
If we start out on the flop, do we have to assign a donking range for the BB or can we just pretend he either check-calls or check-folds on this flop (i.e. start the tree with a SB's decision point)?
Will Tipton Video Pack 2 - Solving Poker Quote
08-11-2014 , 03:24 AM
Quote:
Originally Posted by KnutXX
Just finished the video series and wanted to apply what we have learned to Example 1 on p.196 in v1. I created the game tree but I was wondering if we start on the flop or assign river ranges and start on the river.
If we start out on the flop, do we have to assign a donking range for the BB or can we just pretend he either check-calls or check-folds on this flop (i.e. start the tree with a SB's decision point)?
Ch 7 is on river play, and all the examples there assume river starting ranges and then look at play on the river. The solution to Ex 1 is described starting on pg 196.
Will Tipton Video Pack 2 - Solving Poker Quote
08-11-2014 , 08:57 AM
Quote:
Originally Posted by MixedUp Strategy
Just curious, how many decision points in your game tree and how big is the game? Did you write your own tree builder?
It had about 7k decision points, I'm not sure exactly what "how big is the game" means but it took about 1.5 days to finish calculating. I wrote my own decision tree builder.
Will Tipton Video Pack 2 - Solving Poker Quote
08-12-2014 , 05:38 AM
In the video you show that for BB in the turn situation AhKsQd2d, certain hands are indifferent between checking and betting.
I don't have exactly the same range for SB as I added some pocket pairs: 99,66.
The only hand I can find which BB plays 50/50 is T6o : ranges[1].getAmbiFrac = 0.50275,
ranges[15].getAmbiFrac = 0.49725 ; but the evs are not near enough for indifference:
evs['BB'][1] = 19.7167 while
evs['BB'][15] = 19.6735.
Is there a bug or 300 iterations not enough, or is there no reason to have indifferent hands. That would deter me as most of the reasoning in the two volumes for a play is based on making villain indifferent on his options?
But I'm not really sure here as SB has done nothing yet except check back with her preflop range...

Also I saw the convergence to the equilibrium with f = 1/(2+n) is somewhat slow (on the order of 1/nIter), I was wondering if we could not get an order (1/nIter²) by using f=1/(2+n/2) or even faster convergence. I see that the solution we get start to oscillate but is that a problem for the convergence?

Other question: I feel a bit lost on how to use the program for preflop play. Say I want to study some situations coming from minraise/limp game tree, I think I should take into account all turn and river cards, but even after reducing the size of the tables, I don't think my computer can handle it. Is there no other way to do that? I was thinking in the way some big games are simulated nowadays with some variants of Monte-Carlo as UCT. Couldn't we not do this in the Fictitious Play algorithm?
Will Tipton Video Pack 2 - Solving Poker Quote
08-13-2014 , 04:14 AM
Golly, I've seen some hardcore geekery in my time, but this thread sets a new standard, for sure.

Awesome.

Installing IPython as we speak ...
Will Tipton Video Pack 2 - Solving Poker Quote
08-18-2014 , 09:58 AM
Hi all.

First of all congrats will for both the books and the video series, they are great.

I´m trying to start with something I was excecting to be easy, but I´m struggling a bit with it. I´m trying to solve the GTO strategy for both BTN and SB in the river, knowing the complete board and the river starting ranges for both players.

The initial stacks I used where 10.000, tree starts in the SB decision (bb can´t lead), and can bet a bit over 50% pot or checkbehind, and BB can fold, call or raise about half pot. SB can only call or fold. Think its a very easy scenario to solve

I added a line in the fictitious play loop showing this:

print "I am " + str(evSB+evBB-20000)+ " away from equilibrium"

If i´m not wrong, this should be 0 if we reach the exact solution.

But I think it isnt. Have run up to 30000 iterations of fictitious play and I´m pretty sure its never going to converge to 0. Here are some results:


iteration 473: 20.5156124734 away from equilibrium
iteration 1108: 17.8704847799 away from equilibrium
iteration 5100: 17.4260830438 away from equilibrium
iteration 30000: 16.6990137029 away from equilibrium

I also aded some code to the updateranges function, as I think its never reaching extreme values because of the design of the fraction calculation:

if fracFinal > 0.995:
fracFinal = 1.0
elif fracFinal < 0.005:
fracFinal = 0.0

This way I make sure it never checks behind or just calls with the absolute nuts, or doesnt call the absolute worst hand.

Am i doing something wrong? Shouldn´t I be able to find a pair of strategies that shows I´m zero (or very close) chips away from equilibrium?
Will Tipton Video Pack 2 - Solving Poker Quote
08-18-2014 , 10:37 AM
regarding: doFP(minrshoveTree)

The results converge on SB folding 100% and BB folding 100% of hands.

So far:

I've tested with 1 iteration to see if the ranges were initializing correctly and it does seem as if they are.

I've checked my minrshoveTree to see if it correctly matches the books version and it does

My spair.dump() gives me the exact same ranges Will gets in the video, so that code is most likely fine.

I've looked over the code and I cant find any errors.


Does anyone have any advice on how I can diagnose the problem?
Will Tipton Video Pack 2 - Solving Poker Quote
08-18-2014 , 12:46 PM
Quote:
Originally Posted by klondi
Iwe run into another problem with the range class.

Seems same as user Mrpete had previously.

When i run the Range class block there are no errors.
but when i try to display bob i get this

Code:
E:\Programmer\Ipython\lib\site-packages\IPython\core\formatters.py:239: FormatterWarning: Exception in image/svg+xml formatter: unsupported operand type(s) for +=: 'float' and 'NoneType'
  FormatterWarning,
<__main__.Range instance at 0x05B480A8>

I tryed to debug by running this block

Code:
bob._repr_svg_()
Wich result in the same problem as Mrpete had ( i dont know if his problems was solved ?)

Code:
TypeError                                 Traceback (most recent call last)
<ipython-input-50-301a190942bb> in <module>()
----> 1 bob._repr_svg_()

<ipython-input-48-bd9a4511d63f> in _repr_svg_(self)
    131         for i in range(numRanks):
    132             for j in range(numRanks):
--> 133                 frac = self.getAmbigFrac(ranks[i], ranks[j], i > j)
    134                 hexcolor = '#%02x%02x%02x' % (255*(1-frac), 255, 255*(1-frac))
    135                 result += '<rect x="' + str(i*20) + '" y="' + str(j*20) + '" width="20" height="20" fill="'                        + hexcolor+'"></rect>'

<ipython-input-48-bd9a4511d63f> in getAmbigFrac(self, rank1, rank2, suited)
    124                     continue
    125                 nHand += 1 # short for nHand = nHand +1
--> 126                 nFrac += self.getFrac(pe.string2card([card1,card2]))
    127         return nFrac / nHand
    128 

TypeError: unsupported operand type(s) for +=: 'float' and 'NoneType'
Been staring at the code for like 2 hours without any progress.

Is it posibel to get a litle more help, becase im sorta hit a dead end here.
Have a look at your getFrac function. I think I had a typo in there.
Will Tipton Video Pack 2 - Solving Poker Quote
08-18-2014 , 02:25 PM
@ Mrpete.

Yes thanks for the help.

I havd already found the problem a while ago though :-)
Will Tipton Video Pack 2 - Solving Poker Quote
08-18-2014 , 04:19 PM
I havent started using ipython yet, As i understand one will be able to create nearly everything one wants if one puts the amount of hours in. Will it be possible to create a tool, that shows me how often a certain preflop range hits a specific boards (has a certain handstrength on this board, like Top pair or gutshot). just like a software like flopzilla, but gives out only the raw data..
How long will it take to create somethig like this? and could you give me a guide of how to do it? (I admit i havent worked through the whole video series yet, so excuse me if you do something similiar already)
Will Tipton Video Pack 2 - Solving Poker Quote
08-19-2014 , 04:25 PM
is there a page or a post that explains setting up ipython + a compatible equity library under mac os x?
Will Tipton Video Pack 2 - Solving Poker Quote

      
m