I am implementing a Naive Bayes classifier in Python from scratch. The instructions I have asks that I incorporate Laplacian Smoothing with K=1 to computing the probability that a message belongs to a given class. I have two classes, ham and spam (E-mail spam filtering problem). So one example without smoothing would be if I had X spam messages and Y spam messages:

P(X) = X / (X+Y) --> Probability that a class is spam in my dataset P(Y) = Y / (X+Y) --> Probability that a class is ham in my dataset

I don't know how to incorporate Laplacian Smoothing to this simple formula.



Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.