Skip to main content

Posts

Maximizing Returns: The Kelly Criteria Explained

This is more a tutorial write up and less a puzzle. So without further ado here you go. Q: You have a certain amount of money. You are playing a coin tossing game where you know that the probability of you winning in a certain toss is 'p'. You can keep tossing this coin as long as you want. How much of your money should you bet on each toss to maximize your overall returns. The Kelly Capital Growth Investment Criterion: Theory and Practice (World Scientific Handbook in Financial Economic Series) A: This problem was first described by J.L. Kelly in 1956 and is known as the "Kelly Criteria". It provides a direct formula for what fraction of your money you should be betting. The interesting thing here is that the Kelly criteria has been used in gambling and investment strategists (including the likes of Warren Buffet). So how does one arrive at that formula? The following is an easy and simple explanation for it. Fortune's Formula: The Untold Story of the Sci...

The Magician's Coin Tossing Experiment

Q: A magician calls you in and using his magical powers claims to make all coin tosses he does fall a heads. You challenge him, and he tosses the coin once and the coin falls heads. What is the probability that he actually has magical powers? He tosses it again, and it falls heads. What is the probability now that he actually has magical powers? A: This is classic Bayesian. Assume you have a low belief in this person. Set it as 'p'. He flips the first coin and it lands a heads. This new evidence, which favours the hypothesis must lead us to adjust our belief in our value of 'p'. This may not seem intuitive at first glance, partly because the amount of information is very small (1 toss). But lots of real world problems deal with scarce data (more on that on a later post). Here is an earlier post describing Bayesian reasoning. So, to cast it in that same framework lets start with our hypothesis. Hypothesis H = Magical Powers Exist Evidence    E  = 1 heads seen ...

Lottery Raffle Optimization Puzzle

Q: You participate in an raffle. You have bought a certain number of raffle tickets and there are several prizes to choose from. Assuming you don't care amongst the prizes, do you put all your tickets in one box or distribute them across all the boxes? A: Several offices have these kind of raffles internally during holiday seasons (Christmas) and I thought it would be worthwhile to formalize it with some proofs and simulations. Assume you have bought "r" tickets and that there are "N" total tickets outside of the "r" you bought. Also assume that there are "m" prizes to be won. You are faced with two broad options. 1) Put them all in one box. 2) Put them evenly in all the boxes. That is, each box gets r/m raffle tickets. An example of the two options is shown below. If you assume that all the other raffle tickets are placed evenly, then the probability of winning a prize, should you go with option 1 is simply If you go with option...

The Naive Bayesian Approach to Machine Learning

On this write up, I'll explain the Naive Bayesian (NB) approach that is used in machine learning. First of, the "naive" in NB is part of the name, not an adjective added. The method is simple, robust and fairly effective for a lot of cases. Every engineer dealing with data absolutely must know this technique. It is one of those techniques which is simple and computable yet fairly simple to explain to people without a machine learning background. Machine Learning: A Probabilistic Perspective (Adaptive Computation and Machine Learning series) To start with, let us look at some data. Assume you run  a coffee shop. You keep a log of the gender of every customer along with their age which you estimate. Granted this estimation may not be accurate, but it should be reasonably within range. You also keep track of whether the customer bought a coffee cup that you had put up prominently on display. The data is shown in the table below Gender Age Buy Cup (Y/N) M tee...