An Intro to Bayesian Inference & Poker (aka Hand Reading)

User avatar
AJG
Posts: 1138
Joined: Thu Jun 11, 2009 1:07 am
State: SA
888PL Name: .pKoIkNeGr.
Contact:

An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby AJG » Mon Oct 25, 2010 2:52 am

It is little known outside of math/statistics circles that there is actually more than 1 'framework' that can be applied to probability.
The one most people are aware of is known as 'Frequentist Probability'. This basically views probability from the standpoint of an infinite number of experiments or trials, each producing there own independent result (an event) - such as dealing out an infinite number of Hold'em starting hands - and frequentist probability tells us we will get AA (on average) once every 220 times, for example.

The other most common framework is known as 'Bayesian Probability', named after Thomas Bayes, an 18th Century mathematician.
This takes a rather different approach, and it captures mathematically what poker players try intuitively to do, in that it makes use of a 'prior probability' and makes adjustments based on future observations. Although often players do a rather bad job of this - an example is "Opponent raised, they might have AK, A72r flop and they bet so its more likely he has AK (atleast a A)?"

I will state the formula first, and give brief explanation, then show an example and confirm it with a separate method.
Note: P(X) means the Probability of X.

Bayes' Theorem:

Code: Select all

            P(E|H) x P(H)
  P(H|E) =  -------------
                P(E)

Where H is some hypothesis we have made (and wish to refine) and E is an observed Event which may affect H.
P(H) is the 'prior probability' of the hypothesis.
P(E) is the probability of the Event.

Now of course, P(A|B) needs explanation:
This is called a 'Conditional Probability', and P(A|B) reads as 'The conditional probability of event A given that event B occured',
and is used for events that are dependant (such as in poker, as compared to flipping coins). However, the implicative function of conditional probabilities is 'right to left' in that we can also interpret this as 'What is the probability that B implies A'.
See here for a more indepth look at conditional probability.

So we can read Bayes' Theorem like this:
We formulate some hypothesis, H, and assign it some initial (prior) probability P(H).
We then observe some event E, that has probability P(E) of occuring.
What is the a revised probabilty of H, or P'(H), in light of E occuring?

Which is kind of the opposite inference from the (naive) Poker example above.

Something else essential to the process of Hand Reading is thinking in terms of combinations of cards, ie how many different AK hands are there? How many TT hands are there? etc

Here I introduce 2 simple formulae from Combinatorics, that make working with card combinations much easier:

1) Unpaired hands: Combinations = #Card1 x #Card2
Example: How many different combinations of KT are there? Well there are 4 of each card -> 4 x 4 = 16.
We can simply add these to include more hand types, for example KJ OR KT = 32 combinations
Say we want to know how many combinations of Ax+ are there where, say, x >= T.
There are 4 cards that fit for x (T,J,Q,K), and we know there are 16 combos of each
so 16 x 4 = 62 combos of AT+.

For unpaired hands, these 16 combinations consists of 12 offsuit combinations and 4 suited.

2) Paired Hands: Combinations = #Cards x (#Cards - 1) / 2
Example: How many different combinations of TT are there? 4 Tens gives 4 x 3 / 2 = 6

Of course, both of these formula still hold when considering card removal effects.
Example: Preflop we hold an Ace -> leaving 3 in the deck.
Now how many combinations of AK are left? -> 3 Aces x 4 Kings = 12 (9 offsuit and 3 suited)
Now how many combinations of AA are left? 3 x (3 - 1) / 2 = 3.
From this we can immediately see the impact of our holding an Ace: only 3/4 of the AK (or AQ whatever) combos remain, and 1/2 the AA combos.

So how does Bayes' Theorem apply to Poker?
Consider this example:

I hypothesise that my opponent has an Ace (I do not), lets call this H and assign probability P(H)
Now we see the flop, which is A84. What is the (new) probability P'(H) in light of this?

I will work a general version of this example to show that it works, then a more specific one to give some idea of how powerful this techniques can be.

So preflop, given we don't hold an Ace, the (frequentist) probability that our opponent holds 1 Ace is 0.150 (15%)
We can use the combinatorics formula above to help calculate this:
There are 16 combinations of AK, likewise AQ and so on, and there are 12 other cards to go with the Ace, therefore the total number of hands than contain exactly 1 Ace is 16 x 12 = 192.
Now removing 1 card reduces the number of combinations by 4, we hold 2 cards, so we need to subtract 2 x 4 = 8 from 192 to get the remaining combinations of Ax = 184. (ie if we hold a 7, there a 4 less combinations of A7 our opponent can possibly have)

There are a total of 52 * 51 / 2 = 1326 combinations of Hold'em starting hands, however as we have 2 cards ourselves, this leaves 50 * 49 / 2 = 1225 possible 2 card combinations our opponent can hold, so the probability out opponent holds an Ace is 184 / 1225 = 0.150
To work out the probability of holding 1 or more Aces, we simply add 6 (the number of AA combos) to the quotient 184.

So we have P(H) = P(Opp has A) = 0.150
P(1 Ace Flops) = 0.21 (I wont take the space to show the working for this or the next figure)
And the probability that an Ace flops, given our opponent holds one: P(1 A Flops | Opp has A) = 0.16

Now we have all the figures neccessary to use Bayes' Theorem to 'update' the probability that our opponent holds and Ace, given that we see 1 in the flop.

Code: Select all

                           P(1 A Flops | Opp has A) x P(Opp has A)
P(Opp has A | 1 A flops) = -------------------------------------
                                      P( 1 Ace Flops )
                              
                        0.16  x  0.15
                     =  -------------
                             0.21
                           
                     = 0.114

So we have 'refined' the probability of our opponent holding an Ace from 15% preflop, to 11.4% after we see an Ace on the flop.

OK, so lets check this using combinations alone and card removal effects (frequentist approach):

Removing 1 Ace, number of combos containing 1 Ace is 12 x 12 = 144: 144 / 1225 = 0.111 (11.1%)

Which is 0.3% different from the answer we got using Bayes' Theorem, an entirely acceptable level of differrence, so this 'confirms' the Bayesian approach. (Not to mention rounding error, and use of differing degrees of accuracy in the figures - 2 or 3 decimals)


Now, lets apply this to a more common scenario in Poker. (factor additional information also)
This time, our opponent open raises from UTG. Lets say we know he is doing this 10% of the time (from our HUD), so we assign him a top 10% hand. (Somewhat naive, but often true, esp at lower stakes where 'balancing' is either unknown or not practiced often)
1 common method of this, taking 17 of 169 hand types, gives a range of {88+,ATs+,KTs+,QJs,AQo+} - consisting of 98 hand combinations.
Now, consider how many of these hands contain 1 Ace : the ATs+ and AQo+ portion of the range.
We have the full 16 combos for AQ and AK = 32
and 4 combos for AJs and ATs = 8, hence 40 combinations have 1 Ace, so 40 / 98 = 0.408 (40.8%)
So here P(Opp has A) = 0.408

So now after seeing the same flop as above, what is the probability our opponent holds an Ace or P'(H)?

The only value that has changed is P(Opp has A), which is now 0.408 instead of 0.150, applying Bayes' Theorem we get:

Code: Select all

   0.16 x 0.408
   ------------
       0.21
      
  = 0.311

So now we have refined the probability of our hypothesis from 40.8% preflop, to 31.1% on the flop, a reduction of almost 10%!

Looking back at our preflop thoughts, we saw opponent's hands that had 1 Ace were 40 of the 98, however now they consist of 31.1% of 98 which is approximately 31 hands, so we have eliminated 9 hands of our opponents range!

9 hands may not sound like a lot, but it is. But also consider we only applied ONE piece of information here (1 Ace flops) and we can often apply more observations to refine this further...

Now compare this to the first 'reasoning' example above, where a bet from our opponent when an Ace flops leads to the idea that our opponent has an Ace, or that our opponent more likely has an Ace given he bet. The Bayesian approach tells us exactly the opposite (although we have not included the 'bet information' in this analysis - lets say we know opponent CBets 50% of the time he doesnt hit). But, you say, so does frequentist approach tell us the same thing. Yes, BUT only if we look at it in the correct way, but the problem lies in that this is not immediately intuitive. ie, We normally do not consider events that happen subsequent in time will have an effect on the probability of a precedent event.
Bayes' Theorem tells us they do.

This gives you a taste of how Bayesian Inference (using Bayes' Theorem to make inferences) works, but really the power lies in the implications of Bayes' Theorem itself (after all, we could have worked all this out using standard frequentist methods, if we do so correctly, however our intuition is often wrong in this regard).
This is not an easy thing to explain (or understand), so I will redirect you to an excellent resource for this - "An Intuitive Explanation of Bayes' Theorem" or "an excruciatingly gentle introduction". Also here (which also describes conditional probabilities rather well - and visually).
I guarantee you will be amazed how counter-intuitive some problems (and poker often falls in this category) really are. If you arent, then you are a rare person indeed!

But just quicky, looking at Bayes' Theorem itself, we can see a few implications of immediate benefit.

1) P'(H) is INVERSLY PROPORTIONAL to P(E).
- This means, the diference between P'(H) and P(H) will be smaller the larger P(E) is, and vice versa.
- Likely observations (events) will result in only small changes from P to P', unlikely observations in large changes.
- To see this, imagine the flop is AAx above, (much less likely) and we can see intuitively that P'(H) will be even less that 0.111

2) P'(H) is DIRECTLY PROPORTIONAL to P(H).
- This means the difference will be larger the larger P(H) is, and vice versa.
- Likely hypothesise result in larger changes from P to P', after the observed event.
- To see this, imagine we set P(H) to 1 (certain) above, then P'(H) is 75% -> difference of 25%

3) Also notice that 'The probability of our hypothesis, given our observation' is also directly proportional to 'The probability of our observation, given our hypothesis'.


This has been a basic introduction to Bayes' Theorem, and a small taste of applying it to Poker.
I hope to post some more applications of it to Poker later, in the mean time, think it over and discuss whats been presented thus far (or ask for clarification of any points).

Addendum: Some links of possible interest:
http://en.wikipedia.org/wiki/Probabilit ... pretations
http://en.wikipedia.org/wiki/Bayes'_theorem
http://en.wikipedia.org/wiki/Bayesian_inference
http://en.wikipedia.org/wiki/Discrete_p ... stribution
http://www.bluefirepoker.com/thread.aspx?thrid=2599
http://www.cardplayer.com/cardplayer-ma ... rt-players
http://archives1.twoplustwo.com/showfla ... 37&fpart=1
http://www.ruffpoker.com/blog/poker-mat ... s-theorem/
http://www.google.com.au/webhp?sourceid ... 270ec8e787
Last edited by AJG on Mon Oct 25, 2010 5:40 pm, edited 1 time in total.
Image ...11.59% of bad beat stories are just misplayed hands ...

User avatar
trishan
Posts: 4515
Joined: Thu Jun 18, 2009 5:04 pm
State: VIC
888PL Name: nplking
Location: Melbourne
Contact:

Re: An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby trishan » Mon Oct 25, 2010 9:25 am

Hey Aaron,

Thanks for writing that up. You have presented a great explanation and set of examples. I tried to take light hearted approach to introducing Bayes Theorem when this sub-forum was first created but it went downhill quickly! (Not because of the the theory but because of the example I used - long story).

Bayes theorem is a really powerful tool. I will be back later tonight to add to this thread.
FoldPre Forums - Old 888PL Forumers register here

User avatar
maccatak11
Posts: 4447
Joined: Tue Jan 22, 2008 11:39 pm
State: SA
888PL Name: maccatak11
Location: At the tables
Contact:

Re: An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby maccatak11 » Mon Oct 25, 2010 11:08 am

Good write up Aaron, well explained.

Question:
In many situations in poker, its profitable to know the maths really specifically, e.g. calculating pot or implied odds against an opponents range (which is why programs like pokerstove exist obv).

When hand reading however, is there a porfitable benefit in knowing such specific numbers? Hand reading is much more than a general formula obviously. My feeling is that things like player notes, past history, bubble factors, effective stack sizes etc etc make a formula like the one you presented really hard to apply in real time, and make it less and less relevant.

Most experienced players know that in a certain situation that "as played he has a medium strength Ace a lot of the time here," or <insert other example here>, and a strength of a lot of experienced players is that they can do this quickly and pretty accurately, based on their HEM stats, but also a lot of the other less tangible things that i mentioned before.

I guess my question is: what can intermediate to advanced players gain from this that they dont already know? Although they use a different process - reads/feel etc - the actual outcome - raise/fold/whatever is likely to be the same? I doubt this will actually change the way these players play much, and as such, could it be overcomplicating events in the real time?
Riskers gamble, experts calculate.

User avatar
bennymacca
Moderator
Posts: 16623
Joined: Mon Dec 03, 2007 11:30 am
State: SA
888PL Name: bennyjams
Location: In your poker Nightmares
Contact:

Postby bennymacca » Mon Oct 25, 2010 12:53 pm

You can use it to confirm or modify reads when reviewing sessions which you can then use in the future

Ie you could review your play of pocket pairs on ace high boards and see if you systematically fold or call too often.

User avatar
maccatak11
Posts: 4447
Joined: Tue Jan 22, 2008 11:39 pm
State: SA
888PL Name: maccatak11
Location: At the tables
Contact:

Re: An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby maccatak11 » Mon Oct 25, 2010 1:26 pm

so, somebody has a top pair ace 31.2% of the time, and we have a pocket pair. How does that information affect what we do the next time we are in that situation? How will we know if we are calling too much, or not raising enough or whatever.

Yes the player could be the same, or have similar stats, but as i said, what about everything else that goes into making a decision. Something as simple as board texture makes a huge difference.

I think its too simplistic myself. well possibly simplistic is the wrong word, but perhaps its too rigid i think.
Riskers gamble, experts calculate.

User avatar
AJG
Posts: 1138
Joined: Thu Jun 11, 2009 1:07 am
State: SA
888PL Name: .pKoIkNeGr.
Contact:

Re: An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby AJG » Mon Oct 25, 2010 4:22 pm

Cheers trishan and macca(s)...

Matt: I will defer a more detailed reply, but here point back to the sentence:

but really the power lies in the implications of Bayes' Theorem itself


And the brief points I made below it in OP...

Also remember all I have done here is introduce the fundamental idea. One could write a book (multi volume) on this (indeed ppl have), so I needed to keep the 1st post reasonably simple...

Also, I will just point out here that nothing I post in this thread (past or future) is opinion. None of it is original ideas... It is either mathematical fact, or application of such to poker - from other (much more capable) heads than mine...
Last edited by AJG on Mon Oct 25, 2010 4:29 pm, edited 1 time in total.
Image ...11.59% of bad beat stories are just misplayed hands ...

User avatar
AJG
Posts: 1138
Joined: Thu Jun 11, 2009 1:07 am
State: SA
888PL Name: .pKoIkNeGr.
Contact:

Re: An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby AJG » Mon Oct 25, 2010 4:24 pm

trishan wrote:Hey Aaron,

Thanks for writing that up. You have presented a great explanation and set of examples. I tried to take light hearted approach to introducing Bayes Theorem when this sub-forum was first created but it went downhill quickly! (Not because of the the theory but because of the example I used - long story).

Bayes theorem is a really powerful tool. I will be back later tonight to add to this thread.

Cool..

But where was this other discussion... Looked and found nothing in this sub-forum?
Image ...11.59% of bad beat stories are just misplayed hands ...

User avatar
AceLosesKing
Posts: 9557
Joined: Wed Dec 05, 2007 10:26 pm
State: SA
888PL Name: Aces2Kings
Location: Updating my status.
Contact:

Re: An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby AceLosesKing » Mon Oct 25, 2010 4:32 pm

trishan wrote:Hey Aaron,

Thanks for writing that up. You have presented a great explanation and set of examples.


maccatak11 wrote:Good write up Aaron, well explained.


Thanks guys.
Scott wrote:Seriously, how hard is it to get his name right.

Aaron Coleman.

User avatar
AJG
Posts: 1138
Joined: Thu Jun 11, 2009 1:07 am
State: SA
888PL Name: .pKoIkNeGr.
Contact:

Re: An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby AJG » Mon Oct 25, 2010 5:19 pm

An example might serve to illuminate how easily intuition can fail us, when dealing with probabilities....

Here's a story problem about a situation that doctors often encounter:

1% of women at age forty who participate in routine screening have breast cancer. 80% of women with breast cancer will get positive mammographies. 9.6% of women without breast cancer will also get positive mammographies. A woman in this age group had a positive mammography in a routine screening.
What is the probability that she actually has breast cancer?

Try to work it out before looking here:
Did you come up with something like 70-80% or 90.4% chance?
Read on for a surprising result...
(and take heart in that apparently only 15% of doctors get this right to!)

We can use standard frequentist methods to come to the right answer, but the point meant to be demonstrated here is that often our intuition as to how to go about this leads to incorrect results:

Lets put some numbers to this, lets take a sample of 10,000:

There are 2 groups of women:
1 - Those that have cancer = 100
2 - Those that do not have cancer = 9900

After the test, the women can be divided into four groups:

A: 80 women with breast cancer and a positive result.
B: 20 women with breast cancer and a negative result.
C: 950 women without breast cancer and a +ve result. (9.6% of 9900)
D: 8,950 women without breast cancer and a -ve result.

The answer is: A / (A + C) = 7.8%
Or, of all the women with positive results (A+C), only A of them actually have cancer...

The most common error made in this problem, is substituting the 'prior' probability that a particular woman has cancer (1%), with the % of +ve results that actually have cancer (80%). Or thinking the chance of true +ve is 1 - chance of false positive (9.6% here)

Now consider applying Bayes' Theorem to this problem:
Hypothesis H is that the patient has cancer, Event E is a +ve test result
P(H) = 0.01
P(E) = 0.10 (nice convenient numbers that allow us to do this in our heads, as its just shifting decimal places)
and P(E|H) = 0.80

so we have P(H|E) = P(E|H)xP(H)/P(E) = 0.8 x 0.01 / 0.1 = 8%

I borrowed this example, but added using Bayes' Theorem to compute the result... Hopefully showing that that is the easier method (and also more accurately represents reality than our intuition often does)
Image ...11.59% of bad beat stories are just misplayed hands ...

User avatar
trishan
Posts: 4515
Joined: Thu Jun 18, 2009 5:04 pm
State: VIC
888PL Name: nplking
Location: Melbourne
Contact:

Re: An Intro to Bayesian Inference & Poker (aka Hand Reading)

Postby trishan » Mon Oct 25, 2010 5:32 pm

I used an example like the one above but the example I used offended someone so it was removed.
FoldPre Forums - Old 888PL Forumers register here


Return to “Advanced Discussion”

Who is online

Users browsing this forum: No registered users and 0 guests