MLCrack

    PROBABILITY & STATISTICS · INTERVIEW QUESTION

    Explain conditional probability and independence. How are they used in Naive Bayes?

    🟡 intermediate · Probability Theory

    Hint: P(A|B) = P(A∩B)/P(B). Independence means P(A|B) = P(A).

    Answer

    Conditional probability P(A∣B)P(A|B) = P(A∩B)P(A∩B)/P(B)P(B) measures the probability of A given B occurred. Two events are independent if P(A∩B)P(A∩B) = P(A)$$P(B), meaning knowing B doesn't change A's probability. Naive Bayes classifier uses Bayes' theorem with the 'naive' conditional independence assumption: P(x1,...,xn∣C)P(x₁,...,xₙ|C) = ∏P(xi∣C)P(xᵢ|C). This dramatically reduces parameters from exponential to linear. Despite the unrealistic independence assumption, it works well because:

    1. Classification only needs the correct ordering of P(C∣x)P(C|x), not calibrated probabilities
    2. Dependencies often cancel out.

    Applications: spam filtering, text classification, medical diagnosis.

    Variants: Gaussian NB (continuous), Multinomial NB (counts), Bernoulli NB (binary).