Bayesian Reasoning - Explained Like You're Five

5 Satoshi_Nakamoto 24 July 2015 03:59AM

(This post is not an attempt to convey anything new, but is instead an attempt to convey the concept of Bayesian reasoning as simply as possible. There have been other elementary posts that have covered how to use Bayes’ theorem: here, here, here and here)

 

Bayes’ theorem is about the probability that something is true given some piece or pieces of evidence. In a really simple form it is basically the equation below:


This will be explained using the following coin flipping scenario:

If someone is flipping two coins: one fair and one biased (has heads on both sides), then what is the probability that the coin flipped was the fair coin given that you know that the result of the coin being flipped was heads?

 

Let’s figure this out by listing out the potential states using a decision tree:

 

We know that the tail state is not true because the result of the coin being flipped was heads. So, let’s update the decision tree:

 

 

The decision tree now lists all of the possible states given that the result was heads. 

Let's now plug in the values into the formula. We know that there are three potential states. One in which the coin is fair and two in which it is biased. Let's assume that each state has the same likelihood.

So, the result is: 1 / 1 + 2 which is 1 / 3 which equals 33%.Using the formula we have found out that there is 33% chance that the coin flipped was the fair one when we already know that the result of the flip was heads.

 

At this point you you may be thinking what any of this has to do with bayesian reasoning. Well, the relation is that the above formula is pretty much the same as Bayes’ theorem which in its explicit form is:

 

You can see that P(B|A) * P(A) (in bold) is on both the top and the bottom of the equation. It represents “expected number of times it’s true” in the generic formula above. P(B|~A) * P(~A) represents "expected number of times it's false".

 

You don’t need to worry about what the whole formula means yet as this post is just about how to use Bayesian reasoning and why it is useful. If you want to find out how to deduce Bayes' theorem, check out this post. If you want some examples of how to use Bayes' theorem see one of these posts: 123 and 4.


Let’s now continue on. This time we will be going through a totally different example. This example will demonstrate what it is like to use Bayesian reasoning.

Imagine a scenario with a teacher and a normally diligent student. The student tells the teacher that they have not completed their homework because their dog ate it. Take note of the following:

  • H stands for the hypothesis which is that the student did their home work. This is possible, but the teacher does not think that it is very likely. The teacher only has the evidence of the student’s diligence to back up this hypothesis which does affect the probability that the hypothesis is correct, but not by much.
  • ~H stands for the opposite hypothesis which is that the student did not do their homework. The teacher thinks that this is likely and also believes that the evidence (no extra evidence backing up the students claim and a cliché excuse) points towards this opposite hypothesis.

 

Which do you think is more probable: H or ~H? If you look at how typical ~H is and how likely the evidence is if ~H is correct, then I believe that we must see ~H (which stands for the student did not do their homework) as more probable. The below picture demonstrates this. Please note that higher probability is represented as being heavier i.e. lower in the weight-scale pictures below.

 

The teacher is using Bayesian reasoning, so they don’t actually take ~H (student did not do their homework) as being true. They take it as being probable given the available evidence. The teacher knows that if new evidence is provided then this could make the H more probable and ~H less probable. So, knowing this the teacher tells the student that if they bring in their completed homework tomorrow and provide some new evidence then they will not get a detention tomorrow. 

 

Let’s assume that the next day the student does bring in their completed homework and they also bring in the remains of the original homework that looks like it has been eaten by a dog. Now, the teacher, since they have received new evidence, must update the probabilities of the hypotheses. The teacher also remembers the original evidence (the student’s diligence). When the teacher updates the probabilities of the hypotheses, H (student did their homework) becomes more probable and ~H (student did not do their homework) becomes less probable, but note that it is not considered impossible. After updating the probabilities of the hypotheses the teacher decides to let the student out of the detention. This is because the teacher now sees H as being the best hypothesis that is able to explain the evidence.

 

The below picture demonstrates the updated probabilities.

 

 

If your reasoning is similar to the teachers, then congratulations. Because this means that you are using Bayesian reasoning. Bayesian reasoning involves incorporating conditional probabilities and updating these probabilities when new evidence is provided.

 

You may be looking at this and wondering what all the fuss is over Bayes’ Theorem. You might be asking yourself: why do people think this is so important? Well, it is true that the actual process of weighing evidence and changing beliefs is not a new practice, but the importance of the theorem does not actually come from the process, but from the fact that this process has been quantified, i,e, made it into an expressible equation (Bayes’ Theorem). 

 

Overall, the theorem and its related reasoning are useful because they take into account alternative explanations and how likely they are given the evidence that you are seeing. This means that you can’t just get a theory and take it to be true if it fits the evidence. You need to also look at alternative hypotheses and see if they explain the evidence better. This leads you to start thinking about all hypotheses in terms of probabilities rather than certainties. It also leads you to think about beliefs in terms of evidence. If we follow Bayes’ Theorem, then nothing is just true. Thing are instead only probable because they are backed up by evidence. A corollary of this is that different evidence leads to different probabilities.  

An example demonstrating how to deduce Bayes' Theorem

3 Satoshi_Nakamoto 24 July 2015 03:58AM

(This post is not an attempt to convey anything new, but is instead just an attempt to provide background context on how  Bayes' theorem works by describing how it can be deduced. This is not meant to be a formal proof. There have been other elementary posts that have covered how to use Bayes’ theorem: here, here, here and here)

 

Consider the following example

Imagine that your friend has a bowl that contains cookies in two varieties: chocolate chip and white chip macadamia nut. You think to yourself: “Yum. I would really like a chocolate chip cookie”. So you reach for one, but before you can pull one out your friend lets you know that you can only pick one, that you cannot look into the bowl and that all the cookies are either fresh or stale. Your friend also tells you that there are 80 fresh cookies, 40 chocolate chip cookies, 15 stale white chip macadamia nut cookies and 100 cookies in total. What is the probability that you will pull out a fresh chocolate chip cookie?

 

To figure this out we will create a truth table. If we fill in the values that we do know, then we will end up with the below table. I have highlighted in yellow the cell that we want to find the value of.

 

Chocolate Chip

White Chip Macadamia Nut

Total

Fresh

 

 

80

Stale

 

15

 

Total

40

 

100

 

If we look at the above table we can notice that, like in Sudoku, there are some values that we can fill in based on the information that we already know. These values are coloured in grey and they are:

  • The number of stale cookies. We know that 80 cookies are fresh and that there are 100 cookies in total, so this means that there must be 20 stale cookies.
  • The number of white chip macadamia nut cookies. We know that there are 40 chocolate chip cookies and 100 cookies in total, so this means that there must be 60 white chip macadamia nut cookies

 

If we fill in both these values we end up with the below table:

 

Chocolate Chip

White Chip Macadamia Nut

Total

Fresh

 

 

80

Stale

 

15

20

Total

40

60

100

 

If we look at the table now, we can see that there are two more values that can be filled in. These values are coloured in grey and they are:

  • The number of fresh white chip macadamia nut cookies. We know that there are 60 white chip macadamia nut cookies and that 15 of these are stale, so this means that there must be 45 fresh white chip macadamia nut cookies.
  • The number of stale chocolate chip cookies. We know that there are 20 stale cookies and that 15 of these are white chip macadamia nut, so this means that there must be 5 stale chocolate chip cookies.

 

If we fill in both these values we end up with the below table:

 

Chocolate Chip

White Chip Macadamia Nut

Total

Fresh

 

45

80

Stale

5

15

20

Total

40

60

100

 

We can now find out the number of fresh chocolate chip cookies. It is important to note that there are two ways in which we can do this. These two ways are called the inverse of each other (this will be used later):

  • Using the filled in row values. We know that there are 80 fresh cookies and that 45 of these are white chip macadamia nut, so this means that there must be 35 fresh chocolate chip cookies.
  • Using the filled in column values. We know that there are 40 chocolate chip cookies and the 5 of these are stale, so this means that there must be 35 fresh chocolate chip cookies.

 

 If we fill in the last value in the table we end up with the below table:

 

Chocolate Chip

White Chip Macadamia Nut

Total

Fresh

35

45

80

Stale

5

15

20

Total

40

60

100

 

We can now find out the probability of choosing a fresh chocolate chip cookie by dividing the number of fresh chocolate chip cookies (35) by the total number of cookies (100). This is 35 / 100 which is 35%. We now have the probability of choosing a fresh chocolate chip cookie (35%).

 

To get to the Bayes' theorem I will need to reduce the terms to a simpler form.

  • P(A) = probability of finding some observation A. You can think of this as the probability of the picked cookie being chocolate chip.
  • P(B)  = the probability of finding some observation B. You can think of this as the probability of the picked cookie being fresh. Please note that A is what we want to find given B. If it was desired, then A could be fresh and B chocolate chip.
  • P(~A) = negated version of finding some observation A. You can think of this as the probability of the picked cookie not being chocolate i.e. being a white chip macadamia nut instead.
  • P(~B) = a negated version of finding some observation B. You can think of this as the probability of the picked cookie not being fresh i.e. being stale instead.
  • P(A∩B) = probability of being both A and B. You can think of this as the probability of the picked cookie being fresh and chocolate chip.

 

Now, we will start getting a bit more complicated as we start moving into the basis of the Bayes’ Theorem. Let’s go through another example based on the original.

Let’s assume that before you pull out a cookie you notice that it is fresh. Can you then figure out the likelihood of it being chocolate chip before you pull it out? The answer is yes.

 

We will find this out using the table that we filled in previously. The important row is underlined.

 

Chocolate Chip

White Chip Macadamia Nut

Total

Fresh

35

45

80

Stale

5

15

20

Total

40

60

100

 

Since we already know that the cookie is fresh, we can say that the likelihood of it being a chocolate chip cookie is equal to the number of fresh chocolate chip cookies (35) divided by the total number of fresh cookies (80). This is 35 / 80 which is 43.75%.

 

In a simpler form this is:

  • P(A|B) - The probability of A given B. You can think of this as the probability of the picked cookie being chocolate chip if you already know that it is fresh.

If we relook at the table we can see that there is some extra important information that we can find out about P(A|B). We can discover that it is equal to P(A∩B) / P(B) You can think of this as the probability of the picked cookie being chocolate chip if you know that it is fresh (35 / 80) is equal to the probability of the picked cookie being fresh and chocolate chip (35 / 100) divided by the probability of it being fresh (80 / 100). This is P(A|B) = (35 / 100) / (80 / 100) which becomes 0.35 / 0.8 which is the same as the answer we found out above (43.75%). Take note of the fact that P(A|B) = P(A∩B) / P(B) as we will use this later.

 

Let’s now return to the inverse idea that was raised previously. If we want to know the probability of the picked cookie being fresh and chocolate chip, i.e. P(A∩B), then we can use the underlined parts of the filled in truth table.

 

Chocolate Chip

White Chip Macadamia Nut

Total

Fresh

35

45

80

Stale

5

15

20

Total

40

60

100

If we know that the cookie is known to be fresh like in the top row above, then we can find out that: P(A∩B) = P(A|B) * P(B). This means that the probability of the picked cookie being fresh and chocolate chip (35 / 100)  (remember that there were 100 cookies in total) is equal to the probability of it being chocolate chip given that you know that it is fresh (35 / 80) times the probability of it being fresh (80 / 100) . So, we end up with P(A∩B) = (35 / 80) * (80 / 100) which becomes 35% which is the same as 35 / 100 which we know is the right answer.

 

Alternatively, since we know that we can convert P(A|B) to P(A∩B) / P(B) (we found this out previously) we can also find out that:P(A∩B) = P(A|B) * P(B). We can do this by using the following method:

  1. Assume P(A∩B) = P(A|B) * P(B)
  2. Convert P(A|B) to P(A∩B) / P(B) so we get P(A∩B) = (P(A∩B) * P(B)) / P(B).
  3. Notice that P(B) is on both the top and bottom of the equation, which means that it can be crossed out
  4. Cross out P(B) to give you P(A∩B) = P(A∩B)

 

The inverse situation is when you know that the cookie is chocolate chip like in the left column in the table above. Using the left column we can find out that:  P(A∩B) = P (B|A) * P(A). This means that the probability of the picked cookie being fresh and chocolate chip (35 / 100) is equal to the probability of it being fresh given that you know it is chocolate chip (35 / 40) times the probability of it being chocolate chip (40 / 100). This is: P(A∩B) = (35 / 40) * (40 / 100). This becomes 35% which we know is the right answer.

 

Now, we have enough information to deduce the simple form of Bayes’ Theorem.

Let’s first recount what we know:

  1. P(A|B) = P(A∩B) / P(B)
  2. P(A∩B) = P(B|A) * P(A)

By taking the first fact: P(A|B) = P(A∩B) / P(B) and using the second fact to convert P(A∩B) to P(B|A) * P(A) you end up with P(A|B) = (P(B|A) * P(A)) / P(B) which is Bayes' Theorem in its simple form.

 

From the simple form of Bayes' Theorem, there is one more conversion that we need to make to derive the explicit form of Bayes' Theorem which is the one we are trying to deduce.

 

To get to the explicit form version we need to first find out that P(B) = P(A) * P(B|A) + P(~A) * P(B|~A).

To do this let’s refer to the table again:

 

Chocolate Chip

White Chip Macadamia Nut

Total

Fresh

35

45

80

Stale

5

15

20

Total

40

60

100

 

We can see that the probability that the picked cookie is fresh (80 / 100) is equal to the probability that it is fresh and chocolate chip (35 / 100) plus the probability that it is fresh and white chip macadamia nut (45 / 100). So, we can find out that the probability of P(B) (cookie is fresh) is equal to 35 / 100 + 45 / 100 which is 0.8 or 80% which we know is the answer. This gives the formula:P(B) = P(A∩B) + P(~A∩B)

 

We know that P(A∩B) = P(B|A) * P(A) as we found this out earlier. Similarly we can find out that  P(~A∩B) = P(~A) * P(B|~A)This means that the probability of the picked cookie being fresh and white chip macadamia nut (45 / 100) is equal to the probability of it being white chip macadamia nut (60 / 100) times the probability of it being fresh cookie given that you know that it is white chip macadamia nut (45 / 60). This is: (60 / 100) * (45 / 60) which is 45% which we know is the answer.

 

Using this information, we can now get to the explicit form of Bayes' Theorem:

  1. We know the simple form of Bayes' Theorem: P(A|B) = (P(B|A) * P(A)) / P(B)
  2. We can convert P(B) to P(A∩B) + P(~A∩B) to get P(A|B) = (P(B|A) * P(A)) / (P(A∩B) + P(~A∩B))
  3. We can convert P(A∩B) to P(A) * P(B|A) to get P(A|B) = (P(B|A) * P(A)) / (P(A) * P(B|A) + P(~A∩B))
  4. We can convert P(~A∩B) to P(~A) * P(B|~A) to get P(A|B) = (P(B|A) * P(A)) / (P(A) * P(B|A) + P(~A) * P(B|~A))

Congratulations we have now reached the explicit form of Bayes' Theorem:  


The Just-Be-Reasonable Predicament

5 Satoshi_Nakamoto 16 July 2015 03:17AM

If people don't see you as being “reasonable”, then you are likely to have troublesome interactions with them. Therefore, it is often valuable to be seen as “reasonable”. Reasonableness is a general perception that is determined by the social context and norms. It includes, but is not limited to, being seen as fair, sensible and socially cooperative. In summary, we can describe it as being noticeably rational in socially acceptable ways. What is “reasonable” and what is rational often converges, but it is important to note that they can also diverge and be different. For example, it was deemed “unreasonable” to free African-Americans from slavery because slavery was deemed necessary for the economy of the South.

 

The just-be-reasonable predicament occurs when you are chastised for doing something that you believe to be more rational and/or optimal than the norm or what is expected or desired. The chastiser has either: not considered, cannot fathom or does not care that what you are doing or want to do might be more rational and/or optimal than what is the default course of action. The predicament is similar to the one described in lonely dissent in that you must choose between making what you to believe to be the most rational and/or optimal course of action and the one that will be meet with the least amount of social disapproval. 

 

An example of this predicament is when you are playing a game with a scrub (a player who is handicapped by self-imposed rules that the game knows nothing about). The scrub might criticise for continuing to use the best strategy that you are aware of, but that they thinks is cheap. If you try to argue that a strategy is a strategy, then the argument is likely to end with the scrub getting angry and saying the equivalent of “just be reasonable”, which basically means: “why can’t you just follow what I see as the rules and the way things should be done?” When you encounter this predicament, you need to weigh up the costs of leaving the way or choosing a non-optimal action vs. facing potential social disapproval. The way opposes being “reasonable” when it is not aligned with being rational. In the scrub situation, the main benefit of being “reasonable” is that you are less likely to annoy the scrub and the main cost is that you are giving up a way to improve for both you and the scrub. The scrub will never learn how to counter the “cheap” strategy and you won’t be looking for other strategies as you know you can always just fall back to the “cheap” strategy if you want to win.

 

In general, you have three choices for how to deal with this predicament: you can be “reasonable”, explain yourself or try to ignore it. Ignoring it means that you continue or go ahead with the ration/optimal course of action that you had planned and that you also to change the conversation or situation so that you don't continue getting chastised. Which choice you should make depends on thecorrigibility and state of mind of the person that you need to explain yourself to as well as how much being “reasonable” differs from being rational. If we reconsider the scrub situation, then we can think of times when you should, or at least most people would, avoid the so called “cheap” strategy. Maybe, it is a bug in the game or it’s overpowered or your goal is fun rather than becoming better at the game. (Note, though, that becoming better at a game often makes it more fun).

 

The just-be-reasonable predicament is especially troubling because, like with the counter man syndrome, repeated erroneous thinking can become embedded into how you reason. In this case, repeated acquiescence can lead to embedding irrational and/or non-optimal ways of thinking into your thought processes.

 

If you continually encounter the just-be-reasonable predicament, then it indicates that your values are out of alignment with the person that you are dealing with. That is, they don’t value rationality, but just want you to do things in the way that they expect and want. Trying to get them to adopt a more rational way of doing things will often be a hard task because it involves having to convince them that their current paradigm from which they are deriving their beliefs as to what is “reasonable” is non-optimal.


Situations involving this predicament come in four main varieties:

  • You actually should just be “reasonable” – this occurs when you are being un”reasonable” not because the most rational or optimal thing is opposed to what is currently considered “reasonable”, but because you are being irrational. If this is the case, then make sure that you don’t try to rationalize and instead just be “reasonable” or try to ignore the situation so that you can think about it later when you are in a better state of mind.
  • Someone wants you to be “reasonable”, but hasn’t really thought about or cares about whether this is rational – this might occur when someone is angry at you because you are not following what they think is the right way to do things. It is important in this situation to not use the predicament as a way of avoiding thoughts about how you might be wrong or how the situation might be like from the other person’s perspective. This is important because, ultimately, you want to change the other person’s opinion about what is “reasonable” so that it matches up more with what is rational. To do this well you often need to be empathetic, understanding and strategic. You need to be strategic because sometimes you may need to ignore the situation or be what they think is “reasonable” so that you can reapproach the topic later without it being contaminated with negative valence. A good idea if you want to avoid making the other person feel like you are imposing is to get them to agree to try out your more rational method on a trial basis. This is also useful for two other reasons: what you think is more rational may turn out not to be and the “reasonable” way of doing things, on reflection, may turn out to be more rational than you think. Something additional to consider is that everyone has different dispositions, propensities and tendencies and what might be the most optimal strategy for you might not be for someone else. If this is the case, then don’t try to change their strategy, but just try to explain why you want to use yours.
  • Someone is telling you to be “reasonable” as a power play or as a method of control – this situation happens when someone is using their power to make you follow their way of doing things. This situation requires a different tact than the last one because your strategies to explain yourself probably won’t work. This is because being told to “just be “reasonable”” is a method that they are using to put you in your place. The other person is not interested in whether the “reasonable” thing is actually rational. They just want you to do something that benefits them. This kind of situation is tough to deal with. You may need to ignore and avoid them or if you do try to explain yourself make sure that you get the support of others first.
  • You don’t want to explain yourself – sometimes we notice that what people think is “reasonable” is not actually rational, but we do the “reasonable” thing anyway because the effort or potential cost involved with explaining yourself is considered to be too high. In this case, you either have to be “reasonable” or try to avoid the issue. Please note that this solution is not optimal because avoiding something when you don’t have evidence that it will go away is a choice to reface the same or worse situation in the future and accepting an unsavoury situation in resignation is letting fear control and limit you.

If you encounter the just-be-reasonable predicament, I recommend running through the below process:  

 

Some other types of this predicament would be “just do as you’re told”, “why can’t you just conform to my belief of what is the best course of action for you here” and any other type of social disapproval, implicit or explicit, that you get from doing what is rational or optimal rather than what is expected or the default.