Skip to content

Accurate spam email detection using machine learning and BERT. Includes training scripts, evaluation tools, and a web interface for real-time classification.

Notifications You must be signed in to change notification settings

allmen/email-spam-classifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

📧 Spam Email Classification

A powerful spam email classifier combining traditional machine learning and deep learning (BERT, DistilBERT) to detect spam with high accuracy. Includes a full pipeline from preprocessing to deployment with an interactive web interface.

🚀 Quick Start

🔧 Setup

Clone the repo and install dependencies:

git clone https://github.com/allmen/email-spam-classifier.git
cd spam-classifier
pip install -r requirements.txt

Download NLTK data:

python -c "import nltk; nltk.download('stopwords'); nltk.download('punkt')"

⚙️ Train Models

# Train all models (ML + DL)
python train_models.py

# Train only ML (faster)
python train_models.py --no-dl

📊 Evaluate Models

python evaluate_models.py

🌐 Run Web App

python app.py
# Visit http://localhost:5000

📁 Key Files

  • train_models.py: Train spam classifiers
  • evaluate_models.py: Evaluate performance
  • app.py: Flask web app
  • notebooks/: Interactive notebook
  • web/templates/index.html: UI page

🧠 Models Used

  • Traditional ML: Naive Bayes, SVM, Random Forest, Logistic Regression
  • Deep Learning: BERT, DistilBERT
  • Ensemble: Combines ML and DL for best results

🤝 Contributors

Special thanks to the contributors of this project:

  • @allmen – ML integration and research
  • @usmaino – Deep learning model tuning

🙏 Acknowledgments

  • Hugging Face for their pre-trained transformer models
  • SpamAssassin for foundational spam detection datasets and techniques

Built with ❤️ by a passionate team for email security and AI learning.

About

Accurate spam email detection using machine learning and BERT. Includes training scripts, evaluation tools, and a web interface for real-time classification.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published