You can explain the Bayes formula in pure English.
Despite being overloaded with seemingly complex concepts, it conveys an important lesson about how observations change our beliefs about the world.
Let's take it apart!
↓ A thread. ↓
Essentially, the Bayes formula describes how to update our models, given new information.
To understand why, we will look at a simple example with a twist: tossing a biased coin.
Suppose that we have a magical coin!
When tossed, it can come up with heads or tails, but not necessarily with equal chance.
The catch is, we don't know the exact probabilities. So, we have to perform some experiments to find that out.
To mathematically formulate the problem, we denote the probability of heads with 𝑥.
What do we know about 𝑥?
At this point, nothing. It can be any number between 0 and 1.
Instead of looking at 𝑥 as a fixed number, let's think about it as an observation of the experiment 𝑋.
To model our (lack of) knowledge about 𝑋, we assume that each value is equally probable.
This distribution is called the prior.
(Note that we are working with probability density functions, not distributions.
The values of the density function are not probabilities, despite the notation!)
So, suppose that we tossed our magical coin, and it landed on tails.
How does it influence our model?
We can tell that if the probability of heads is some 𝑥, then the likelihood of our experiment resulting in tails is 1-𝑥.
However, we want to know the probability distribution with the condition and the event in the other way around: we are curious about our probabilistic model of the parameter, given the result of our previous experiment.
This is called the posterior distribution.
Now let's put everything together!
The Bayes formula is exactly what we need, as it expresses the posterior in terms of the prior and the likelihood.
It might be surprising, but the true probability of the experiment resulting in tails is irrelevant.
Why? Because it is independent of 𝑋. Also, the integral of the posterior evaluates to 1.
Here it is 0.5, but this can be hard to evaluate analytically in the general case.
So, we have our posterior. Notice that it is more concentrated around 𝑥 = 0. (Recall that 𝑥 is the probability of heads.)
This means that if we only saw a single coin toss and it resulted in tails, we guess that the coin is biased towards that.
Of course, we can do more and more coin tosses to refine the posterior further.
(After 𝑘 heads and 𝑛 - 𝑘 tails, the posterior will be the so-called Beta distribution, more info here: en.wikipedia.org/wiki/Beta_dist…)
To summarize, here is the Bayes formula in pure English. (Well, sort of.)
posterior ∝ likelihood x prior
Or, in other words, the Bayes formula just describes how to update our models given new information!
Having a deep understanding of math will make you a better engineer. I want to help you with this, so I am writing a comprehensive book about the subject.
If you are interested in the details and beauties of mathematics, check out the early access!
Why is matrix multiplication defined the way it is?
When I first learned about it, the formula seemed too complicated and counter-intuitive! I wondered, why not just multiply elements at the same position together?
Let me explain why!
↓ A thread. ↓
1/11
First, let's see how to make sense of matrix multiplication!
The elements of the product are calculated by multiplying rows of 𝐴 with columns of 𝐵.
It is not trivial at all why this is the way. 🤔
To understand, let's talk about what matrices really are!
2/11
Matrices are just representations of linear transformations: mappings between vector spaces that are interchangeable with addition and scalar multiplication.
Let's dig a bit deeper to see why are matrices and linear transformations are (almost) the same!