This project implements a spam email flagger that uses Bayesian Inference. This are my very first steps in ML, and Naive Bayes is a perfect starting point. I built it using The Spam Assassin Email Classification Dataset I built the frontend with Next.js (TypeScript) and TailwindCSS for the styling, and I used Python's FastAPI for the backend. I didn't really need to use any machine learning library.
It's pretty straightforward, you just need to paste text and then you can check the probability of an email being a spam by clicking the analyze button.
Returns the probability of an email being spam in the format:
label: spam | not spam ; score: number/100
(the body should be in the JSON format "text" : "your text")
You need to have npm and python installed on your machine.
cd frontend && npm installcd backend && python3 -m venv .venv && pip install -r requirements.txtThe classifier uses a Naive Bayes approach:
- Tokenizes email text
- Computes word probabilities from the dataset
- Applies Bayes' theorem
- Outputs spam probability
Spambusters was inspired by a podcast by Micode featuring Fabien Pinckaers, the creator of Odoo. He was talking about how "not every task needs an openai api call", because sometimes there are algorithms that take up way less time compared to using ai. One of them is Naive Bayes which is what I used here.