Downloads · 30 days
57
31% of all-time downloads
MiguelJeronimoOliveira/email-classifier
email-classifier is a text classification model from MiguelJeronimoOliveira. Use it when you need a label for a piece of text. The card lists the license as apache-2.0.
A fine-tuned DistilBERT model for binary classification of emails as productive or unproductive. This model is designed to automatically categorize emails to help prioritize important communications.
Downloads · 30 days
57
31% of all-time downloads
All-time downloads
181
Public
Parameters
178M
711 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors711 MB · 100%
From the Hugging Face model README
A fine-tuned DistilBERT model for binary classification of emails as productive or unproductive. This model is designed to automatically categorize emails to help prioritize important communications.
distilbert-base-uncased0: Unproductive (emails that don't require action)1: Productive (emails that require action or response)The model was trained on a synthetic dataset of ~6,000 emails (balanced between productive and unproductive) generated using templates that simulate real-world email scenarios. The training data includes:
The model was evaluated on a held-out test set with the following metrics:
Note: Exact metrics may vary. Please refer to the model card for specific evaluation results.
pip install transformers torch
from transformers import pipeline
classifier = pipeline(
"text-classification",
model="MiguelJeronimoOliveira/email-classifier"
)
# Classify an email
result = classifier("Hi, I need urgent technical support. The system is down.")
print(result)
# [{'label': 'LABEL_1', 'score': 0.98}]
result = classifier("Thank you for the excellent work!")
print(result)
# [{'label': 'LABEL_0', 'score': 0.95}]
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
# Load model and tokenizer
model_name = "MiguelJeronimoOliveira/email-classifier"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForSequenceClassification.from_pretrained(model_name)
# Prepare input
email_text = "Hi, I would like to schedule a meeting to discuss the project timeline."
inputs = tokenizer(
email_text,
truncation=True,
padding=True,
max_length=512,
return_tensors="pt"
)
# Get prediction
with torch.no_grad():
outputs = model(**inputs)
predictions = torch.nn.functional.softmax(outputs.logits, dim=-1)
predicted_class = predictions.argmax(dim=-1).item()
confidence = predictions[0][predicted_class].item()
# Interpret result
label = "productive" if predicted_class == 1 else "unproductive"
print(f"Classification: {label} (confidence: {confidence:.2f})")
LABEL_0 or 0: UnproductiveLABEL_1 or 1: ProductiveIf you use this model in your research or application, please cite:
@misc{email-classifier-2024,
title={Email Classifier: A Fine-tuned DistilBERT for Productivity Classification},
author={Miguel Jeronimo Oliveira},
year={2024},
howpublished={\url{https://huggingface.co/MiguelJeronimoOliveira/email-classifier}}
}
For questions, issues, or contributions, please contact:
This model is licensed under the Apache 2.0 License. See the LICENSE file for more details.
Model Version: 1.0.0
Last Updated: 2024
Base Model: distilbert-base-uncased
Framework: PyTorch