Wednesday, September 9, 2015

Hold'em or Fold'em: Validating a Winning Strategy

Introduction

In previous posts (here and here) I analyzed simulated hold'em poker hands to determine a winning strategy.  Bluffing aside, when should you play and when should you fold in order to have the best chances of winning?

The observations I made do not readily yield a single strategy for play.  They may sometimes conflict or be overly conservative when combined.  For example, my advice for hole cards may offer a more than 50% chance of winning on its own, but when combined with the advice on hand rankings (which also offers a better than 50% chance of winning) it may require the folding of many winning hands.

Still, we need a place to start.  Perhaps the principles I generated can be condensed, simplified, reorganized, and summed up in this way:

A Strategy

  • Hole cards
    • If your hole cards form a pair, contain an Ace, or have a rounded average rank greater than or equal to 10...
      • Continue playing
    • Else
      • Fold
  • Flop, Turn, River
    • If you have two pair 5s or better, one pair Queens or better, or three of a kind or better
      • Continue playing
    • Else
      • Fold
Will this strategy work?  Let's validate it by simulating a game against one other player.

The Program

The program remains largely the same as before, except that I have now implemented the above logic into the program.  If one folds on the hole cards, then this is tracked as "Fold - hole cards".  If one passes this test but fails on the flop, turn, or river, this is tracked as "Fold - Flop, Turn, River".  If one passes both tests, then this is tracked as "Play".

I reran 100,000 simulations of hold'em deals to Player1 and Player2.  A successful strategy will have a high percentage of Win/Play combos along with a high percentage of Lose/Fold combos.  That is, we want to play when we will win, and fold when we will lose.  If our strategy is not successful, then there will be a high percentage of Win/Fold combos (we folded when we would have won the hand) and Lose/Play combos (we played when we would have lost).

In other words, the ideal simplified scenario can be represented by the below confusion matrix:
Play
Fold
Win
50
0
Lose
0
50

In the above scenario, a win is as equally likely as a loss, so each occurs 50% of the time, adding to 100%.  However, we have predicted perfectly, so we won all the hands we have played, and lost only the hands we have folded.  Assuming we have been betting well (betting minimally with hands we will fold, betting maximally with hands we will win), the eventual result will be that we win the game and all of the money.

What does the actual confusion matrix look like?

Validation

The results of implementing this strategy are below:
Player1 Result/Action
Fold - Flop, Turn, River
Fold - hole cards
Play
Grand Total
Lose
10773
32593
4548
47914
Tie
326
3044
816
4186
Win
7158
24708
16034
47900
Grand Total
18257
60345
21398
100000


The table above gives the final result for Player1's hand (left side) and Player1's action based on the simplified principles we gave him (top).  The combinations are displayed in the middle, with row/column totals on the ends.

A simplified version of the table:
Player1 Result/Action
Fold
Play
Grand Total
Lose
43366
4548
47914
Tie
3370
816
4186
Win
31866
16034
47900
Grand Total
78602
21398
100000


Some observations:
  • As we would expect, Player1's hands lose and win about equally
  • Player1 wins about 75% of the hands he plays
  • Player1 only plays 21% of the hands
  • Of all the hands Player1 would have lost, he only plays 9% of them
  • Of all the hands Player1 would have won, he only plays 33% of them
  • 40% of Player1's folds were winning hands
  • Player1 only plays 19% of ties.

Strengths of this approach:
  • Player1 plays very few of the games he will lose
  • The strategy is simple
  • The strategy relies on information known at the time of decision

Weakness of this Approach
  • Player1 folds quite a few games in which, if he had played, he would have won
  • Player1 folds most of the games in which there is a tie (and would split the pot)
  • Player1 plays very few games

This is definitely a conservative strategy.  The result of combining the various insights we have gathered in previous posts is too cautious.  Player1 only plays when there is a great chance of winning.  Perhaps with good betting and bluffing, this can be a very effective strategy.  However, it folds a lot of winning hands, in fact, most winning hands. 

The strategy misclassifies (ignoring ties) 38% of all hands.  Counting ties (assuming you should play ties), it misclassifies 40% of all hands, that is, 40% of the time it recommends a fold when you should play and recommends that you play when you should fold.

Is there a better way?  Most certainly.  Let's use machine learning to analyze our data and come up with a more effective model.

Machine Learning: Decision Tree

I use a decision tree to develop a model for hold'em strategy because it is easy to understand the decision paths.  Here is a plot of the model along with the associated splits and ratios of classification:



The details may be difficult to see, so here is the decision tree strategy with words:
  • Flop, Turn, River
    • If Player1 has two pair or better
      • Play
    • Else (Player1 has one pair or high card)
      • If Player1 has a high card hand
        • Fold
      • Else (if Player1 has one pair)
        • If both of the cards that make up the one pair are in the community cards
          • Fold
        • Else (if only 0 or 1 of the cards that make up the one pair are in the community cards)
          • Play

This model has only 27% misclassification, that is, it predicts a loss when you really win or predicts a win when you really lose, about 27% of the time.  The confusion matrix is below for play/fold and win/lose/tie combinations:

Player1 Result/Action
Fold
Play
Grand Total
Lose
29591
18323
47914
Tie
1452
2734
4186
Win
7429
40471
47900
Grand Total
38472
61528
100000


Some observations:
  • Player1 wins about 66% of the hands he plays
  • Player1 plays 62% of the hands
  • Of all the hands Player1 would have lost, he plays 39% of them
  • Of all the hands Player1 would have won, he plays 84% of them
  • Only 19% of Player1's folds were winning hands
  • Player1 plays 65% of ties.

Strengths of this approach:
  • Most folds are losses; most plays are wins
  • The strategy is simple

Weakness of this Approach
  • The strategy relies on information not known at time of decision (at least before flop)
  • Player1 plays too many hands (in particular, too many losing hands)
This strategy is much more effective.  However, it offers no guidance for the hole cards, recommending that one should always play at least through the flop.

Do the hole cards really matter in an overall strategy?  Looking at another decision tree using only the hole card information (max rank, min rank, average rank, pair (yes/no)) reveals that, at best, the model will still misclassify about 43% of the time.  A simple split based on the average rank of the hole cards being >= 7.5 yields only a slight advantage in winning (54%) and correctly classifies only 45% of the time. 

If we force the previous decision to use the hole card information to its full extent, the model becomes incredibly complex (over 1000 nodes) and only improves to about 26% misclassification.  The decision tree looks like this:



Clearly, this isn't helpful.  But we know hole cards are important to some degree, so shouldn't this count for something?  In addition, this strategy plays too many hands, and as a result, plays too many losing hands.

A Compromise


What should we do now?  If we compare the first strategy, we see that the major problem is that one folds too much, particularly, on hands that would have been won (the lower left corner green box).  It plays too little.  In contrast, the decision tree model plays too much, in particular, it plays too many hands that it will lose (the upper right yellow box).

Is there a way to combine both strategies in a way that is more effective than either, is still simple, plays about 50% of the time, and provides more guidance at each stage of the game?  I combined both approaches and played with the logic until coming up with a more balanced strategy:
  • Hole Cards
    • If the rounded average rank of the hole cards is >= 6 or the hole cards form a pair
      • Continue Playing
    • Else
      • Fold
  • Flop, Turn, River
    • If you have two pair or better
      • Continue Playing
    • Else (one pair or high card)
      • If one pair, only 0 or 1 of the cards that make up the one pair are in the community cards, and the pair is 5s or better
        • Continue playing
      • Else (high card, one pair of 4s or worse, or one pair with both pair cards in the community)
        • Fold
The confusion matrix is as follows (I validated the approach against a test set and the results were virtually the same):

Player1 Result/Action
Fold
Play
Grand Total
Lose
35010
12904
47914
Tie
2005
2181
4186
Win
13500
34400
47900
Grand Total
50515
49485
100000


Some observations:
  • Player1 wins about 70% of the hands he plays
  • Player1 plays 49% of the hands
  • Of all the hands Player1 would have lost, he only plays 27% of them
  • Of all the hands Player1 would have won, he plays 72% of them
  • 26% of Player1's folds were winning hands
  • Player1 plays 52% of ties.
  • The strategy misclassifies 28% of the time.

Strengths of this approach:
  • Most plays are wins; most folds are losses
  • The strategy is still fairly simple
  • The strategy relies more on information known at the time of decision
  • Player1 plays about half the time
  • The misclassification is low.

This approach does not suffer the weakness of the other two approaches, but represents a balanced compromise between them. While the initial strategy is too conservative, the decision tree strategy is too liberal.  This compromise still has good predictive power, is simple, and useful, and represents a middle ground strategy.

Conclusion

As the foregoing shows, there is no single master strategy for winning at poker.  Any strategy will have strengths and weaknesses.  And different strategies may, for this reason, appeal to different people.  What I have shown above are some data driven strategies designed to maximize strengths and minimize weaknesses, but how they do so differs.  Feel free to choose the strategy (or modified suitably) that appeals to you.

This concludes my analysis of poker hands.  For now at least....

Good luck!

1 comment:

  1. It has been simply incredibly generous with you to provide openly what exactly many individuals would’ve marketed for an eBook to end up making some cash for their end, primarily given that you could have tried it in the event you wanted.
    Surya Informatics

    ReplyDelete