2 ms·
Just as background for people who don't work with this stuff much, this is my understanding. Naive Bayes is an application of Bayes Theorem to classification p
by seanhunter 3y ago
Just as background for people who don't work with this stuff much, this is my understanding.
Naive Bayes is an application of Bayes Theorem to classification problems in machine learning. The problem it is solving is where you are trying to classify something and you have a fairly large number of features. The example that is frequently used in the ML community is imagine you have an image and you want to classify it as containing a cat (or not)[1]. The conditional probability you want is P(cat|pixels) or more specifically P(cat|p_1, p_2, ...., p_n) where p_i is a given pixel[2]. The problem is if you want to apply Bayes theorem you would want to calculate all those conditional probabilities and multiply them together. Since each conditional probability is small this would trend to zero in an actual floating point calculation and by the time you apply Bayes you would end up dividing by zero.
To work around this you make the "naive" (aka very obviously wrong) assumption that the probabilities P(cat|p_i) are independent. Then you get to just sum rather than multiply and the problem goes away. The Naive Bayes classifier turns out very useful in spite of the fact that this assumption is definitely wrong. The slightly different problem that arises that a few other people have mentioned is it means that since you are summing if your feature is say a word then as your text gets longer the score gets higher. So long ham emails would get classified as spam if you just used a threshold.
[1] The computer vision community seems weirdly obsessed with classifying cat photos
[2] in the spam filter case you're looking at P(spam|w_i) where W is a bag of words.