Not all choices are equal

Not all choices are equal

We are all familiar with the classic dilemma - you have two (or more) choices and must decide on the best option. Without any other information, your only option is to go with your intuition. Things may change as more details emerge.

This is the reasoning behind Bayes Theorem, the work of an English minister in the 18th century. Whilst there are different views on probability, Bayes Theorem remains a popular tool for many data scientist's today.

Let's make things clearer with an example.?

Did the world's smartest person make the wrong choice?

Marilyn vos Savant has the highest recorded?intelligence quotient?(IQ) in the?Guinness Book of Records, a competitive category the publication has since retired.?She introduced us to a seemingly simple challenge -?The Monty Hall Problem. After describing the solution, many people (more than 10,000) wrote to Marilyn to describe 'the gross error' she had made. It turns out Marilyn was right all along and many people (including reknowned mathematicians) dined on humble pie that year! It's worth watching on YouTube if you haven't seen it before.

The rules of the game

Imagine you’re on a television game show and the host presents you with three closed doors. Behind one of them, sits a prize beyond your wildest dreams. Behind the other two, are smelly old goats. The host encourages you to pick a door, and you select, let's say, door 1. Then, the host, who is well-aware of what’s going on behind the scenes, opens door 3, revealing one of the goats. The host's offer to you is, do you want to stick with door 1, or switch to door 2?

The broader question is no matter which door you first choose, is it always better to change your mind?

Opening doors with Python

We can support Marilyn with a little Python by running many thousands of Monty Hall simulations. The plots below show that the chances increase significantly when you change your mind about which door to open. In this example, each option is executed 100,000 times.

No alt text provided for this image
The simulation clearly shows that it's better to change your mind

This shows that when we stick with our first choice, we win approximately a third of the time. When we exercise our option to change, we win approximately two thirds of the time. Switching doors effectively doubles our chance of winning! While this can be proven mathematically, a few lines of code can often provide insights before making any further commitments.

Setting up the starting conditions is simple enough...

def SetupDoors():
    # Create 3 doors and hide a prize behind one of them
    gameDoors = [False, False, False]
    prize = random.randint(0, 2)
    gameDoors[prize] = True
    
    return gameDoors        

What happens if we stick with our first choice...


correctGuesses = 0
correctList = []

for tries in range(numberOfTries):
    doors = SetupDoors()
    guess = random.randint(0, 2)
    
    if doors[guess]:
        correctGuesses += 1
        
    correctList.append(doors[guess])        

What happens if we change our minds...


correctGuesses = 0
correctList = []

for tries in range(numberOfTries):
    doors = SetupDoors()
    guess = random.randint(0, 2)
    
    # Open a door that has no prize behind it
    while True:
        openDoor = random.randint(0, 2)
        if not doors[openDoor] and openDoor != guess:
            break
    
    # Change the guess to the other door
    for newGuess in range(len(doors)):
        if newGuess != guess and newGuess != openDoor:
            guess = newGuess
            break
    
    if doors[guess]:
        correctGuesses += 1
        
    correctList.append(doors[guess]        

There is a jupyter notebook on GitHub with all of the functioning code if you wish to explore for yourself MH/monty.ipynb at master · mattwibboweaver/MH (github.com).

Making sense of it all

We are often overwhelmed with vast amounts of data in the modern world. Our job is to make sense of it all and derive meaningful insights that make our jobs easier and our businesses more successful.

I'd love to learn how data provides value for your business - or help you make sense of it if it doesn't.

要查看或添加评论,请登录

Matthew Weaver的更多文章

  • Why do your friends have more friends than you?

    Why do your friends have more friends than you?

    It’s more of a statistical trait than a personal one. Have you ever thought that your friends on social media seem to…

  • Ask the Right Questions, Get the Right?Answers

    Ask the Right Questions, Get the Right?Answers

    The ability to ask great questions is one of the biggest differentiators between a great leader and a mediocre one -…

  • Why do LLMs Hallucinate?

    Why do LLMs Hallucinate?

    Because response diversity cannot exist without it Large language models (LLMs) generate text by predicting the most…

  • The Devil’s in the Detail: Why Coastlines Defy Measurement

    The Devil’s in the Detail: Why Coastlines Defy Measurement

    We’ll use a simple fractal to make sense of it all Many of us have dreamt about owning a private island to retire to…

    4 条评论
  • Don’t Be Fooled: Sneaky Stats Can Sabotage Your Sales Analysis

    Don’t Be Fooled: Sneaky Stats Can Sabotage Your Sales Analysis

    Uncover a hidden statistical trap that may be misleading you into making poor business decisions. Imagine you are the…

    2 条评论
  • The long and winding road

    The long and winding road

    Last week, I received an email telling me a recent online purchase was out for delivery. There was a real-time tracking…

    8 条评论
  • Simple is not always easy

    Simple is not always easy

    Last week I wrote about a simple process that can generate complex patterns. Today's topic is the equally 'simple' but…

    7 条评论
  • Can random choices lead to predictable outcomes?

    Can random choices lead to predictable outcomes?

    The simplest algorithms can sometimes generate unexpected outcomes. This post looks at a simple, three-step process and…

  • Digital (image) transformation

    Digital (image) transformation

    Digital transformation can mean many things to many people. In this post, I avoid the bigger question and demonstrate…

    4 条评论
  • My thoughts on Future Decoded 2019

    My thoughts on Future Decoded 2019

    A couple of weeks ago, a familiar journey ended as I arrived at London ExCeL for Microsoft Future Decoded (FD) 2019. My…

    3 条评论

社区洞察

其他会员也浏览了