Downloads · 30 days
0
Anurag43/enron-spam-detector
enron-spam-detector is a text classification model from Anurag43. Use it when you need a label for a piece of text. The card lists the license as mit.
A lightweight, fully free / CPU-only email spam classifier. No GPU, no API costs, no large language model — just classic, fast, and accurate ML.
Downloads · 30 days
0
Access
Public
Updated Jun 3, 2026
Repo size
23 MB
Likes
0
Public
Click a slice to open those files.
.joblib4.8 MB · 71%
From the Hugging Face model README
A lightweight, fully free / CPU-only email spam classifier. No GPU, no API costs, no large language model — just classic, fast, and accurate ML.
Pipeline)| Metric | Score |
|---|---|
| Accuracy | 0.9900 |
| Precision (spam) | 0.9862 |
| Recall (spam) | 0.9940 |
| F1 | 0.9901 |
| ROC-AUC | 0.9996 |
Confusion matrix [ham, spam]: [[978, 14], [6, 1002]]
pip install scikit-learn joblib huggingface_hub
import joblib
from huggingface_hub import hf_hub_download
path = hf_hub_download("Anurag43/enron-spam-detector", "spam_model.joblib")
model = joblib.load(path)
def is_spam(text):
p = float(model.predict_proba([text])[0][1])
return {"label": "spam" if p >= 0.5 else "ham", "spam_probability": round(p, 4)}
print(is_spam("URGENT! You won a $1000 gift card, click now!!!"))
# {'label': 'spam', 'spam_probability': 0.999}
For email input, concatenate the subject and body: text = subject + "\n" + body.
Reproduce with train.py in this repo. Data is cleaned (empty texts dropped, duplicates removed: 31,716 → 28,811 train rows) before fitting.
MIT. Trained on the public Enron spam corpus.
<!-- ml-intern-provenance -->This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.