Friday, August 30, 2013

Poker: Pot Odds 2

Some follow up thoughts on the first post about odds. To get the most precise numbers for your hand's equity/odds, you should compare pot odds with your hand's odds of hitting its outs.

So using the same scenario from the first post, the third/most precise method is as follows:

Method 3 == Pot Odds vs Odds of Hitting Outs
Pot odds == 1:5
Your hand has 8 outs. On the turn, there is 52 - 5 = 47 cards left. Your odds of hitting  outs is 8 : (47-8) == 8:39 == 1:4.875
Since pot odds > odds of hitting outs, you should call.

So note that this is much more precise, and only deals with the turn card (ie. if you had read the second post about bet sizing, this assumes that you will bet optimally on the turn again and that effective stack size is large enough for optimal bet)

However, the disadvantage of pot odds is that when the probability is small, the odds change very rapidly to any small change in probability. ie. 1:49 vs 1:99 is actually only 1% apart. So whereas for equity calculation, you are "safe" if you have say a 5% buffer between required equity vs hand equity, here there is no similar rule and you might be easily mislead as to how much edge you have.

Let's look at what a 5% equity edge means for different pot odds.

Bet SizePot OddsRequired # of Turn Outs Without BufferEquity + 5% BufferRequired Hand Odds With BufferRequired # of Turn Outs With Buffer
1/4x pot1:57.821.7%1:3.610.2
1/2x pot1:311.830.0%1:2.314.2
1x pot1:215.738.3%1:1.618.1
2x pot1:1.518.845%1:1.221.4

Without the 5% buffer, the Required Hand Odds should equal pot odds. Instead, as you can see, 1:5 -> 1:3.6, while 1:1.5 -> 1:1.2. Hence there is no easy way to build in some buffer with pot odds. However, you may have noticed that the required outs actually increases by a constant (2.4 outs) when you build in a 5% buffer. This makes perfect sense- 2.4 outs --> an extra 5% chance of drawing out.

Thus the optimal way to give yourself a buffer is to calculate the odds as is, but then require a couple extra outs to be conservative.

Interestingly, if you look at the # of outs required for 1x pot and 2x pot bets on the flop, they are actually "ahead" (> 50% chance of drawing out by the river). So it seems as though any drawing hand that could call a > pot sized bet could also just raise or push all-in. More on this next.

Wednesday, August 28, 2013

Poker: Bet Sizing

Following the last introductory post to poker, here is an example on how to determine bet sizing based on the texture of the flop.

Let's say effective stack size is 200 BB, we are in button/cutoff, it was limp/folded to us, and we raised to 4-6 BB and one player called. So the pot is ~10 BB (8.5-13.5 BB depending on dead money/size of raise) and effective stack size is 195 BB.

Let's say the flop comes with two flush cards (two cards of same suit) and you have top pair top kicker and you are committed to calling the all-in even if the another flush card comes because you have a weird hunch/you are tilting etc. Let's look at what you need to bet taking into account the implied pot to push a flush draw opponent out of the pot.

The flush draw opponent has 36% equity -> you want to lay 1.8:1 odds for optimal play -> with an implied pot of 10 BB + 195BB, that is a bet of 205/1.8 = 114 BB. This sounds ridiculously huge and incorrect. There are two reasons for this. 

  1. Being willing to commit 200 BB on a flush board with top pair is an incorrect play. 
  2. The existence of a turn bet means that the true "correct bet" amt is much lower. 
We will look at these two lines of thought below and examine what the "correct bet" should be if we take such factors into account..

How much you would typically/normally commit with top pair top kicker
Generally, with top pair or worse, you want to control the pot to be medium sized. Let's look at what that means for the flop/turn/river betting rounds:

  1. if betting sizes were pot sized, I would say two bets would already be really pushing it. (ie. you would control the size by either bet/check/bet or bet/bet/check etc). In this case the pot would be 90 BB by showdown and you and your opponent would have each put in another 40 BB.
  2. if betting sizes were 1/2 pot, it is probably feasible to bet on all three rounds. In this case the pot would just be 80 BB (35BB each since flop). But betting like this might be stupid with the flush draw on the board.

From these rough estimates, it seems that we should be willing to commit another 35-40 BB to this 10 BB pot. Let's say that the implied pot size is 10 + 35 BB. Then the optimal bet is 25BB, or 2.5x the pre-money pot. This certainly seems more reasonable but from what we know empirically about poker betting, it still seems to be on the high end. Let's move on to consider the fact that there can still be betting on the turn/river.

Betting on the turn

From the conclusion of last post, remember that by betting optimally against a dog, each time you bet, you are effectively causing them to loose money equivalent to them folding to the bet in the long run. I would thus make the following statement:

By betting optimally on the turn, it is as though we have cut off the opponent's chances to draw on the river. ie. it is as though the opponent loses the pot right here on the turn.

Now, we can see that perhaps our opponent doesn't have 36% equity, since after they see one card on the turn, we can bet again, which is equivalent to cutting them out right there. So they have 9 outs out of 47 possible turn cards. So we could lay 38:9 ~= 4.2:1 odds to price them out. With a 45BB implied pot, this means betting 10.7 BB ~= 1.1x the pre-money pot. This is more inline with what we know as "normal" betting. 

What is interesting is that if you follow this line of reasoning/betting on the flop, you are committed to betting the turn 100% of the time if no flush cards come out- otherwise you are actually giving your opponent 36% equity and good odds to call on the flop.

So it turns out that maybe our flop bet sizing could vary depending on our game plan on the turn.

As a matter of exercise, let's look at what our proper bet on the turn is. Let's say we just bet another 1x pot on the flop- so the turn pot is 30BB (and we are ready to commit another 25-30BB). What is the optimal bet on the turn if no flush cards come? They have 9 outs out of 46 river cards, so we lay 37:9 ~= 4.1:1 odds. With an implied pot of 60BB, this means that betting 15xBB = 1/2 the pre-money pot.

So either you bet [1.1x pot on flop AND 0.5x pot on turn], or maybe you need to overbet on the flop by betting (at most?) 2.5x pot if you intend to (sometimes? check the turn.

Friday, August 23, 2013

Poker: Intro to Pot Odds

Here's some useful background for anyone interested in poker. Frequently, when someone bets into you, and you are chasing a draw, you need to decide if you want to call or not. Below, we look at a couple ways to think about this.

Before we start, one important definition to get out of the way. The term equity/pot equity may be confusingly used to refer to a % of the pot or an actual $ amount. I will use %equity and $equity to differentiate between these. Both %equity and $equity look at what would happen on average if your hand was taken to show down without any further betting.

Take an example on the turn where the pot is $100. then the opponent bets $25 into pot. We need to decide if we call or not. 

Simple Pot Odds
We are doing the analysis below with the assumption that opponent is all-in (or that there is no more betting on the river). Intuitively, we might already think that it is cheap to call (we can call because the bet was small)- let's see what the math says:

Method 1 == pot odds required probability vs %equity

Pot Odds
  • the opponent just bet 1/4 of the pot.
  • the pot odds that you are getting is 25:125 == 1:5
  • ie. pot odds are post money (inclusive of bet)
  • from the pot odds, the required equity (probability of winning) in order to call is 1/(5+1) = 1/6 = 17%
%Equity (== Your Hand's Actual Probability to Win)
  • looking at your hand vs your opponent's range, what is your probability of winning?
  • let's say you put your opponent on a pair or better and you just have a straight draw.
  • you only win if u hit your draw (8 outs = 18% chance of hitting)
Now compare pot odds probability (17%) to your hand's probability to win (18%) and since hand probability > the probability required from pot odds, this is callable. (maybe in practice you might demand say a 5% buffer before saying it's callable?)

Method 2 == EV calculation
folding = $0 
calling = 18% * 125 + 82% * (-25) = $2
so it's +EV to call. so call
Notice that here, you already take into acct the pot size (125) and the bet size (25).
Compare this to method 1 (the pot odds vs probability method) - the probability calculation doesn't take into acct the bet/pot ratio and that's why you need to compare pot odds to it in method 1.

I think in practice, method 1 is actually easier to work out over the board.


Implied Pot Odds

Now let's say we were not allin (there is more betting on the river). Let's say there's another $50 behind in effective stack size after the call. it's actually very easy to do implied pot odds
25:(125+50) == 1:7
that's it. required equity is 12.5%.
no chg with hand equity. so 12.5% vs 18% == much bigger reason to call/you have much more juice

Looking at the EV method, this is 18% * 175 + 82% * (-25) = $11




Benefits of Offering the Correct Odds

On a side note, i think it is interesting to look at what the EV # means. One way to think about the expected value of your profit at each situation is your $equity - money put in. At each point of decision when you have to decide between raise/bet/call/check/fold, you are seeking to maximize your incremental profit.

Let's go through the scenario above where you and your opponent each put in $50 before the turn, and have $25 each left. At the beginning of the turn, your $equity is $18, so your accumulated profit since the start of the hand is $18 - $50 = -$32.
  1. if you could check it down (opponent hadn't bet) == you would get avg $18 from the pot of $100. Your incremental profit in this scenario is $0. Your accumulated profit since the start of the hand is still -$32.
  2. Opponent bets and you fold. You $equity dropped to $0 here from $18, and you also didn't put any more money in. So your incremental profit for choosing this option is -$18. Your accumulated profit is now -$32 - $18 = -$50.
  3. Opponent bets and you call $25 allin. You would get avg 18%*150 = $27 from the $150 pot. Your $equity increased from $18 to $27, but you also spent $25 calling. Your incremental profit = +$9 -$25 = -$16. Add this to your pre-calling accum profit of -$32 before to see that your post-calling accum profit is -$48.
Note that if you could, you would still much rather get option #1 than having to choose between #2 and #3. In option #3, your are choosing an action that has -EV (you lose another $16). However, choosing option #2 would have even worse consequences (-$18). All this is because your opponent had bet out at you when you had <50% in %equity. You either put in more chips being the underdog, or you fold- effectively losing your pot equity (the chance to draw out on the winner).

This has very interesting implications for when you are playing/betting optimally with the winning hand. 

By making an optimal bet, you win exactly your opponent's $equity since they should be apathetic to folding.

Quick example to show this again: lets say your opponent still has 20% chance (one in five) to draw out on you in a $100 implied pre-money pot. Right now, your accum profit is 80 - 50 = $30. Optimally, you would lay 1:4 odds post-money, or 1/3 of the pre-money pot == $33. If we show that when you make this $33 bet, you are increasing your accum profit from $30 to $50, then we have shown a working example of the statement made above. It is obvious if opponent folds. If opponent calls, then your expected payoff is 80% * 166 = 133 and your cost is 50 + 33 = 83. Accum profit = 133 - 83 = 50. 

Note that this optimal bet sizing is most important to get right when it comes to closer draws (ie. it matter less when you are 90/10 favorite already). I claim this because with a close draw (say 60/40), the opponent still has 40% equity in the pot, so betting correctly to win that 40% equity is likely to be hugely lucrative, vs winning the 10% equity is less so. This may be a reason for why we have more freedom to slow play with trips etc when we are already 90%+ favorites.

Thursday, June 13, 2013

Citifail

Some background info: In Sept 2011, Citigroup + Bloomberg hired a partnership of two companies, Alta and PBSC/Bixi, to create a bike share program for NYC to be delivered in July 2012. PBSC/Bixi is a private non-profit company started by the city of Montreal to create their bike share program back in 2007. After Montreal's success, PBSC/Bixi started expanding internationally, with the aid of Alta, a US company. In the US, Boston and DC are two examples of successful Alta-PBSC/Bixi systems that went off without a hitch. In all those cases (Montreal, Boston, DC), PBSC/Bixi hired a company called 8D Technologies to develop the hardware (terminals, docks, etc) and most importantly, software to manage the thousands of bikes in a typical large city bike share system.

However, in a surprise move, PBSC/Bixi fired 8D Technologies in 2012 and decided to create its own software from scratch. This is the main reason why the NYC program was delayed for a year, despite what they may claim about the effects of Hurricane Sandy. 

It seems that Mayor Bloomberg knew it was the software that caused the delay. In July 2012, Bloomberg said of Citibike: "its software isn't working yet. And just rest assured we're not going to put out any program here that doesn't work." Well, with an estimated 10% of Citibike docks failing every day (according to WNYC), it looks like they did.

Although NYC officials knew that software was the cause of the delay, they didn't know that the true reason was a complete bait and switch of the promised product: "We thought that there would be a substantial transfer of the Washington/Boston software capabilities, not a total rewrite, which is why we thought a July [2012] launch was feasible. But it turned out it's not just a software upgrade." - Gotham Gazette

Not only was NYC left out of the loop, but it seems that their partner, Alta, was unaware as well. "In January [2013] , records show, Alta filed a lawsuit in an Oregon circuit court against Public Bike System Company [PBSC], saying it delivered 'nonconforming goods and faulty goods' to New York's bike-share program. Alta said this week that the suit was never served and that the groups remained partners." - NYT

The main question is, why was 8D Technologies fired? As in all things business, the answer comes down to money. 8D has sued PBSC/Bixi for $26 billion and in response, PBSC/Bixi has countersued $2.5 billion claiming that 8D overbilled for their products. However, if 8D truly overbilled, why was PBSC/Bixi okay with using 8D for Montreal, Boston and DC? You would think that buying another license for a software you've already used several times would be much cheaper than creating your own code from scratch.

It gets even more interesting when one looks closer at PBSC/Bixi. Although it's a private company, it is implicitly backed by the City of Montreal. In 2012, Bixi "was on the brink of collapse and the City of Montreal provided a $37 million loan and guaranteed $71 million in credit. At the same time, the city auditor told BIXI to sell off its international programs since a Quebec municipality cannot participate in commercial activities." Apparently, PBSC/Bixi has had financial issues for years. thetransitwire

I think I know what's going on.

PBSC/Bixi is bleeding money and thought it could save costs by cutting out 8D. They've been working together for so long, PBSC/Bixi figured it could reverse-engineer 8D's software from their previous projects together. This raises major issues concerning intellectual property, as 8D stated in their lawsuit

In order to meet previously promised deadlines, the new software was delivered before it was a fully functioning product, even with its additional one year of development. Amazingly, it has only been previously launched in one other city, Chattanooga, Tennessee (which also suffered delays), which is hardly comparable in scope to NYC's program, which is the largest in the US. Chattanooga seems to have suffered the bait and switch as well: "In Tennessee, the break between 8D and PSBC caught officials off-guard. 'That was not clear to us when the initial contract was awarded'".

Next month, Chicago will get a very similar version of our bike share program. Unsurprisingly, it has been delayed by two weeks. San Francisco has signed on with Alta-PBSC/Bixi as well.

TL;DR: an essentially bankrupt Canadian semi-public company promised NYC one product, but instead delivered an inferior beta version of an untested clone. Furthermore, it's unsure whether they will commit to fixing anything, since PBSC/Bixi's international operations are being sold off and Alta is being sued for unpaid wages by its employees. The only upside is that, unique to all implementations of bike sharing programs, the costs of our's has been completely privately funded by Citigroup.

Saturday, May 18, 2013

Random Thoughts: Desktop Efficiency for Linux

Also see my post on windows desktop efficiency.

I just spent some time making my laptop dual boot ubuntu and windows. While I have played with ubuntu before, I never took the time to customize it for efficiency before. So here are my thoughts.

  1. windows shortcuts still work
    • win + 1,2,3 etc still calls your applications on the task bar
    • I added win + d to show desktop
  2. new shortcuts/desktop management tools
    • a bunch of ctrl+alt shortcuts for manipulating workspace
    • this takes the place of stuff like win + arrow key: presumably you rarely need to tile windows because you can put stuff into different workspaces. There are also windows tiling managers but I haven't looked into that yet. (CompizConfig has a plugin called grid that does this)
  3. for autohotkey equivalents
    • xmodmap for the basic mappings. I'm thinking that this is actually a lot better than my current windows solution- more below.
    • autokey is pretty well developed- you can apparently call python scripts from it
My new ubuntu key mappings maps mode_switch to tab (ie. altgr without the alt). This is a whole new key modifier. (ie. imagine, in addition to ctrl, alt, win, you also have mode_switch) When I was in windows, I had some problems with overloading the functions of the ctrl key For example, I wanted ctrl+l to be right arrow, but then I also wanted ctrl+right to move one word right). My solution then was to differentiate between right ctrl and left ctrl. Rctrl + j -> down, Lctrl + j -> Ctrl + down.

Now, I have my own modifier separated from normal Ctrl functions.This allows you to keep stuff like ctrl + h in your browser to be history (that was a problem before).

Had some installation difficulties along the way, but all-in-all seems quite manageable.