/Spam-Classifier

Naive Bayesian probability based spam classifier. Created as python implementation for the taugh octave classifier in Machine Learning Course by Andrew Ng.

Primary LanguagePythonGNU General Public License v3.0GPL-3.0

Spam-Classifier


Naive Bayesian probability based spam classifier.
Created it as python implementation for the taugh octave spam classifier in Machine Learning Course by Andrew Ng.

Working

            Probability that a message containing a given word is spam
                             P(W|S) * P(S)
             P(S|W) = ----------------------------- 
                      P(W|S) * P(S) + P(W|H) * P(H)
                      
                      
                      
                      
           
             Probability that a given message is spam
                                       p1 p2 ... pN
              p  =  ------------------------------------------------------
                            p1 p2 ... pN + (1 - p1)(1 - p2) ... (1 - pN)

**The classifier takes a body of known spam and ham (non-spam) emails to evaluate.(Just Like training)**
Then, it evaluates each email in a test body of emails as spam or ham, with the difference between ham and spam only known to the classifier for the purpose of calculating the success rate.

Several parameters can be changed to optimize the effectiveness of the classifier. By tweaking these parameters, rates in the upper 90% range for both spam and ham classification can be reached.

Usage

  • Updating soon.......