Is the sum of logs method mathematically equivalent to the multiplication of probabilities (i.e. will it always produce a monotonic ordering of class predictions)?
Re:How To Build a Naive Bayes Classifier
by alexchamberlain on Monday February 27, 2012 @11:04AM
(#3639397)
log(AB) = log(A) + log(B) for all A, B real numbers
Only for A, B > 0, but that's good enough for probabilities (except 0, I guess)
Re:How To Build a Naive Bayes Classifier
by alexchamberlain on Monday February 27, 2012 @11:34AM
(#3639501)
That was there to test you...
Yes you are right, it's better to convert the whole thing to a sum of logs, otherwise you end up with floating-point underflow.
The article was getting already too long however, but I'll add a note about it because it is an important optimization that affects both speed and even correctness (because of the underlying limitations of floating point).
UPDATE: note added.