A lightweight, production-ready Spam Classifier for SMS and short emails. Achieves F1-score ~0.88 on spam class with extremely low false positives using scikit-learn.
Built with clean engineering practices perfect for real-world deployment in telecom, email gateways, or personal security tools.
- Professional text cleaning + domain-specific engineered features
- TF-IDF + numeric feature pipeline (length, keyword flags, punctuation)
- HalvingGridSearchCV hyperparameter tuning
- Isotonic probability calibration for trustworthy confidence scores
- Full evaluation suite (ROC, PR curves, confusion matrix)
- Model saved with joblib (fast loading & compression)
- Ready for deployment
| Metric | Value (Spam class) |
|---|---|
| F1-score | ~ 0.88 |
| Precision | ~ 0.92 |
| Recall | ~ 0.8591 |
| ROC-AUC | > 0.97 |
| Inference speed | < 10 ms / message |
pip install -r requirements.txtIn 2026, spam and AI-powered phishing cost businesses billions annually. This system demonstrates how a well-engineered classic ML solution can deliver enterprise-grade performance with minimal resources.
This project is licensed under the MIT License – see the LICENSE file for details.
- UCI SMS Spam Collection Dataset
- scikit-learn community
Feel free to open an issue or submit a pull request.
Apdoolmajeed Hamza (apdoolhamza)
AI/ML Engineer | Full-stack Web Developer
- LinkedIn: https://www.linkedin.com/in/apdoolhamza/
- GitHub: https://github.com/apdoolhamza/