Did you watch the show Lets make a deal? Were you one of those
people who were always confused which door has car hidden behind it? Well, we bring you a mathematical solution to your confusion. This solution is called BayesTheorem.
Bayes Theorem (alternatively Bayes’ law or Bayes’ rule) describes the probability of occurrence of an event that may be related to any conditions.
The basics of this theorem is defined as below:
Probability of occurrence of an event is calculated depending on other conditions is known as conditional probability. On these lines, Bayes theorem is stated as
Where A and B are the events and P(B)≠0
• P(A)-Probability of A event.
• P(B)-Probability of B event.
• P(A|B) – Probability of A given B is also conditional probability
• P(B|A) – Probability of B given A is also conditional probability
Let’s say we consider
- P(Fire) as Probability of Fire.
- P(Smoke) as Probability of Smoke.
- P(Fire|Smoke) -Probability of Fire when there is Smoke.
- P(Smoke|Fire)-Probability of Smoke when there is Fire.
Bayes Theorem can be derives as follows :
P(A|B)=P(A∩B)/P(B) ————->condition 1
P(B|A) =P(A∩B)/P(A) ———– find the P(A∩B)
Put P(A∩B) in condition 1
P(A|B)=P(B|A)*P(A) /P(B) ————> Bayes’ Theorem
was too much math for you, let me take a routine example for detail
Lets say, you plan to go to party on weekend .You are going to start with two wheeler but the evening is cloudy and below statistics are given :
We need to know that couple should plan party or not ?
P(Rain)=2/30 days =1/15
P(Cloud) = .30
P(Rain|Cloud)=P(Cloud|Rain)*P(Rain) /P(Cloud) —->Bayes Theorem
P(Rain|Cloud)= .80 * (1/15) /.30 =.17
Conclusion is that there is very less chance for the rain so they can enjoy the party without any worries.
Another real time application of Bayes Theorem is Spam Filtering.
P(Spam|Word)=P(Word|Spam)*P(Spam)/P(Word) (Bayes Theorem)
So this mechanism is trying to predict the message is Spam or not in case of words are given.
And there is a higher chances of predicting the messages as Spam where phrases like “some abuses” “you won the lottery” are used.
You may be interested in playing the cards, now let us implement Bayes’ theorem in cards problem.
If I say probability of picking queen from deck of 52 cards. You will shout immediately p(queen)=4/52 =>1/13 (total cards-52 and queen cards-4)
Now If I say probability of picking queen but Face card is given, we need to apply Bayes theorem as condition has been given.
P(Queen|Face) = P(Face|Queen)*P(Queen)/P(Face)
P(Face|Queen)= 1 (All queens are Face card only)
P(Queen)=1/13 (We already looked into it)
Lets make this more interesting!!
Now let us discuss one of the famous problem Monty Hall Problem and solve through Bayes Theorem.
In the problem, you are on a game show, being asked to choose between three doors. Behind each door, there is either a car or a goat. You choose a door.
The host, Monty Hall, picks one of the other doors, which he knows has a goat behind it, and opens it, showing you the goat. (You know, by the rules of the game, that Monty will always reveal a goat.)
Monty then asks whether you would like to switch your choice of door to the other remaining door.
Assuming you prefer having a car more than having a goat,obviously 😉 ,
Do you choose to switch or not to switch?
Let H be the hypothesis “There is a car behind the door1” and E is the evidence that there is a goat behind the door which has been revealed by Monty.
P(H|E) =P(E|H)*P(H)/P(E)= P(E|H)*P(H)/(P(E|H)*P(H)+P(E|notH)*P(notH)) =(1 * 1/3) /(1*1/3 +1 *2/3) =1/3
P(H) is the prior probability that there is a car behind door1 =1/3
P(E|H) =1 because Monty always the show a door with a goat only so probability would be 1