This wikipedia article describes spam filtering using Naïve Bayes: https://en.wikipedia.org/wiki/Naive_Bayes_spam_filtering
It says P(S|W)
is given as Pr(W|S)*Pr(S) / (Pr(W|S)*Pr(S)) + Pr(W|H)*Pr(H))
.
However, one could also get P(S|W)
by estimating P(W)
instead.
Most textbooks simply say it's unnecessary to estimate P(W)
which I get, but one could also say it's unnecessary to estimate Pr(W|H)*Pr(H)
. Why is it that estimating Pr(W|H)*Pr(H))
is preferred?
Example: If we use this example,
The "correct" estimation for P(yes|rain, good)
is 0.143
because
P(rain|yes) * P(good|yes) * P(yes) = 1/5 * 1/5 * 5/10 = 0.02
P(rain|no) * P(good|no) * P(no) = 2/5 * 3/5 * 5/10 = 0.12
P(yes|rain, good) = 0.02 / (0.02 + 0.12) = 0.143
Whereas one could also estimate it as follows which gives 0.042
instead:
P(rain|yes) * P(good|yes) * P(yes) = 1/5 * 1/5 * 5/10 = 0.02
P(rain, good) = P(rain) * P(good) = 3/5 * 4/5 = 0.48
P(yes|rain, good) = 0.02 / 0.48 = 0.042
My question is, why is the former preferred, even though they seem to make similar approximations
Pr(W) = (Pr(W|S)*Pr(S)) + Pr(W|H)*Pr(H))
$\endgroup$Pr( W1, W2 | S) = Pr( W1 | S) * Pr( W2 | S )
vs.Pr( W1, W2 ) = Pr( W1 ) * Pr( W2 )
is not the same though, no? @J.Delaney $\endgroup$Pr(W1,W2|H)
orPr(W1, W2)
, both of which can be used to estimatePr(S|W1, W2)
. But the two ways can result in a different estimate thanks to the conditional independence usually not being true. It seems that estimatingPr(W1,W2|H)
is always preferred, and my question is, why is that - why is that better than estimatingPr(W1, W2)
? @J.Delaney $\endgroup$