Why the Path Was Wet: Understanding Maximum Likelihood

Why the Path Was Wet: Understanding Maximum Likelihood

3 min read
statisticmathcomputer-science

There is a saying

If you're not enjoying science classes, maybe you are learning it from the wrong teacher.

This saying isn’t just for science; I think it's for any topic you're learning.


In my previous class, I learned a statistical method called Maximum Likelihood. It wasn’t very interesting to me while I was being taught. The class was like Maximum Likelihood is a method/process, and here it is. (teacher has written on the whiteboard)

\hat{\theta}_M = \arg \max_\theta P(D \mid \theta, M)

This refers to the maximum probability of the Assumption \theta by observed data D in Model M.

Where,

\hat{\theta}_M = \text{Maximal Likelihood},

D = \text{Observed Data},

\theta = \text{Assumptions},

M=\text{Model},

After the above definition, I found that after a week or less, I couldn't even remember what it was. So I struggle again with learning this.


Finally, in one of my Master's classes, I found the teacher who taught me this again, and I really enjoyed the learning this time. In class, Sir taught us about Maximum Likelihood while teaching us Gene tree estimation. Hence, Sir was teaching us this topic in a very simple and unforgettable way.

Maximum Likelihood is:

Let's say you had a tight sleep last night, as if you had no idea what happened while you were sleeping. In the morning, when you wake up, you see that the path in front of your house is wet. Can you identify why the path is wet?

Well, there might be many assumptions (\theta) here, e.g

  • Maybe at night, it was raining heavily there.

  • Maybe the Gardening got overflowing with watering.

  • Maybe someone mistakenly kept the water pump open.

  • or Maybe WASA's water tankers were flowing water there

  • etc.

To answer this scenario exactly, we need another thing called perspective(M). Hence, there might be a different perspective (M) also, e.g

  • Which session is it? (winter doesn’t have rain, rainy has)

  • Do we have a garden nearby? (so someone is watering)

  • Do we live in Dhaka? (so we will have WASA's tanker,😛)

  • Do we have a water pump, or was electricity available last night?

Now, based on the above discussion, we have all the data we discussed in the Maximum Likelihood equation earlier. Let's map it now.

  1. D (Observed Data): Here, we observe that the Path front-of-house is wet.

  2. \theta (Assumptions): Heavy rain or Watering in garden or Opened Water pump or WASA's water tanker.

  3. M (Model) : The perspective, which is Rainy session or Garden exists or WASA exists or pump exists.

Now Let's map our equation again,

\hat{\theta}_M = \arg \max_\theta P(D \mid \theta, M)

The maximum probability of `Being wet the path` Could be what based on our purpose?

  1. Due to Rain

    • In winter Season:\hat{\theta}_M = \argmax_\text{Rain} P(\text{Wet Path} \mid \text{Rain}, \text{Winter Season}) will have low probability.

    • In Rainy Season:\hat{\theta}_M = \argmax_\text{Rain} P(\text{Wet Path} \mid \text{Rain}, \text{Rainy Season}) will have high probability ✅

  2. Due to Overflowing with watering

    • There is Garden nearby? Yes : \hat{\theta}_M = \argmax_\text{Overflowing with watering} P(\text{Wet Path} \mid \text{Overflowing with watering}, \text{Garden nearby=YES}) will have high probability ✅

    • There is Garden nearby? No: \hat{\theta}_\text{M} = \argmax_\text{Overflowing with watering} P(\text{Wet Path} \mid \text{Overflowing with watering}, \text{Garden nearby=NO})will have less probability.

and so on.

If we keep iterating the function based on our model M, we will have our most likelihood answer for our questions based on our multiple assumptions.

In real problem we will have a model, and based on that model we have to answer which assumption is fit best. As like in that day our class was holding about estimating gene tree, in that case there might have many gene tree but which one suits best based on a given model will be found by Maximum Likelihood.

Sir also has given some other examples too as like, let's say I went to the Dhanmondi 27 from Palashi at 4PM, by which vehicle I went there? is Rickshaw allowed in that street?, Do I have private car ?, or Did I took CNG.