Start with the definition of conditional probability:
P(A∣B)=P(B)P(A∩B)
WHY? This says: "probability of A given B" = "both happen together" divided by "how often B happens". If B is rare, seeing A and B together is relatively more significant.
Similarly, we can write:
P(B∣A)=P(A)P(A∩B)
Rearrange this second equation:
P(A∩B)=P(B∣A)⋅P(A)
WHY? We're expressing the joint probability in terms of "how likely is B if we know A" times "how likely is A in the first place".
Substitute into the first equation:
P(A∣B)=P(B)P(B∣A)⋅P(A)
This is Bayes' theorem. It's just algebra on conditional probability definitions. The beauty: it reverses conditioning. If you know P(B∣A) but want P(A∣B), Bayes gives you the swap.
1.3.04-Random-variables-and-distributions – Bayes extends to continuous distributions (Bayesian updating)
Recall Explain to a 12-Year-Old
Imagine you're a detective. Someone stole cookies, and you find chocolate crumbs. Your suspects: your brother (who loves chocolate, steals cookies 80% of the time when he's around) and your dog (who eats anything, but only20% chance he'd leave crumbs).
Before seeing the crumbs, you thought your brother was around 40% of the time (that's your prior). The crumbs are evidence. Your brother would definitely leave chocolate crumbs if he stole them (high likelihood). The dog might, but less often.
Bayes' theorem is the math that tells you: "Okay, you saw chocolate crumbs. Given that, what's the NEW chance it was your brother?" It combines your starting guess with how well each suspect explains the crumbs. The one who's more likely to create that evidence gets a bigger update. That's Bayes!
#flashcards/ai-ml
What is the formula for Bayes' theorem? :: P(A∣B)=P(B)P(B∣A)⋅P(A) where P(A∣B) is posterior, P(B∣A) is likelihood, P(A) is prior, P(B) is evidence.
What are the four components of Bayes' theorem? :: Posterior P(A∣B), Likelihood P(B∣A), Prior P(A), Evidence/Marginal Likelihood P(B).
Why is the denominator in Bayes' theorem necessary?
It normalizes the posterior probability so that all posteriors sum to 1 and prevents probabilities from exceeding 1.
How do you expand P(B) when it's not directly known?
Use the law of total probability: P(B)=P(B∣A)⋅P(A)+P(B∣¬A)⋅P(¬A).
In the medical test example, why is the posterior probability only 16% despite95% test accuracy?
Because the disease is rare (1% prior). The false positives from the large healthy population (99% × 5% = 4.95%) outnumber the true positives (1% × 95% = 0.95%).
What does "naive" mean in Naive Bayes classifier?
It assumes features are conditionally independent given the class, which is usually false but simplifies computation and often works well in practice.
What is the difference between P(A∣B) and P(B∣A)?
P(A∣B) is the probability of A given B occurred (posterior), while P(B∣A) is the probability of B given A occurred (likelihood). They are generally not equal.
How does Bayes' theorem handle multiple hypotheses?
P(Ai∣B)=∑j=1nP(B∣Aj)⋅P(Aj)P(B∣Ai)⋅P(Ai) where hypotheses Ai are mutually exclusive and exhaustive.
What is the role of the prior probability in Bayes' theorem?
It represents initial belief before seeing evidence. A strong prior (very high or very low) requires strong evidence to shift significantly.
Why does Naive Bayes work despite the independence assumption being violated?
Because the rank order of posterior probabilities is often correct even when absolute values are miscalibrated, which is sufficient for classification.
Bayes' theorem ek aisa powerful formula hai jo apko bata hai ki naye evidence ke baad apni belief ko kaise update karein. Socho ek doctor ko – initially usko lagta hai 1% chance hai ki patient ko disease hai (ye hai prior). Phir test positive ata hai. Ab doctor Bayes' theorem use karta hai: test kitna accurate hai (likelihood), disease kitna common hai (prior), aur test positive ane ki total probability (evidence) – sab combine karke posterior nikalta hai, matlab updated belief. Interesting baat ye hai ki agar disease bohot rare hai, toh bhi 95% accurate test positive aye, toh bhi actual disease hone ki probability sirf 16% ho sakti hai! Kyunki false positives (healthy log jinko test galat positive bata deta hai) true positives se zyada hote hain.
AI aur machine learning mein Bayes ka application bohot common hai. Naive Bayes classifier spam detection, sentiment analysis jaise tasks mein use hota hai. Isme aap assume karte ho ki features independent hain (jo usually galat assumption hai, isliye "naive" naam hai), lekin phir bhi practically bohot acha kaam karta hai. Bayes ka core idea simple hai: prior belief + new evidence = updated belief. Medical diagnosis se lekar email filtering tak, jahan bhi uncertainty hai aur apko probabilities ke sath kaam karna hai, Bayes theorem aapka fundamental tool hai. Isko samajhna AI ke liye bohot zaroori hai kyunki ye uncertainty ko mathematically handle karne ka clean tarika deta hai.