I'm trying classify a document containing words $[x_i...x_n]$ as spam or non-spam, using this equation from Wikipedia:

$$p(spam|x_i,...,x_n) = p(spam)\prod^n_{i=1}p(x_i|spam)$$

But I'm confused about how to apply smoothing. In the Wikipedia article, $N$ is the number of trials, $x$ is a vector of observations of length $d$, and $\alpha$ is the smoothing parameter:

$$p_i = \frac{x_i +\alpha}{N + \alpha d}$$

If I have a 500-word spam corpus, a 1000-word non-spam corpus, and a single email with 23 words, what values should I use for $N$ and $d$? Should this take word frequency into account (e.g. "offer" appears 42 times in spam but only 13 times in non-spam)?


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.