AI / ML · NumPy, SciPy, Pandas
Naive Bayes spam classifier Built
A spam classifier from scratch using word frequencies and Bayes’ theorem, with no ML libraries.
I built a Naïve Bayes spam classifier from scratch using only NumPy, SciPy, and Pandas—no fancy libraries, just the raw math behind one of the classic machine learning algorithms. The goal? To classify emails as spam or not spam based on word frequencies.
Naïve Bayes works on the assumption that words appear independently in emails (which isn’t always true, but it’s surprisingly effective). I trained the model on a dataset of spam and ham emails, calculating word probabilities and making predictions based on Bayes’ Theorem.
This project was less about achieving state-of-the-art accuracy and more about recreating a part of AI history. It gave me a deeper understanding of probabilistic models and how early spam filters worked. If you're interested, you can check out the full implementation on my GitHub.