Text Classification
Transformers
Safetensors
English
roberta
email
urgency-detection
text-embeddings-inference
Instructions to use dfordebarati/email-urgency-roberta with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use dfordebarati/email-urgency-roberta with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-classification", model="dfordebarati/email-urgency-roberta")# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("dfordebarati/email-urgency-roberta") model = AutoModelForSequenceClassification.from_pretrained("dfordebarati/email-urgency-roberta", device_map="auto") - Notebooks
- Google Colab
- Kaggle
Email urgency (RoBERTa)
Rates how urgent a work email is: HIGH, MEDIUM or LOW. It is the urgency model in my final-year email analyser, next to the sentiment and topic models.
Training
- Base: cardiffnlp/twitter-roberta-base-sentiment-latest with a new 3-way classification head.
- Data: the same 499 labelled Enron emails as the topic model. 399 for training, 100 for validation.
- The top 4 transformer layers and the head were trained (28.9M of 124.6M parameters). 10 epochs, batch size 8, learning rate 5e-5, max 128 tokens. Rare levels count more in the loss. The best validation macro-F1 came at epoch 8.
- I also tried each model with a keyword override that forces HIGH when the email says things like "urgent" or "ASAP". The plain model scored better on validation, so it has no override.
Results
Scored on 114 Enron emails kept out of training and validation.
| Method | Accuracy | Macro-F1 |
|---|---|---|
| Previous method (keyword rules) | 63.2% | 0.523 |
| This model | 80.7% | 0.559 |
On a second test set of 90 emails written by the project team, accuracy goes from 73.3% to 76.7% and macro-F1 from 0.572 to 0.611.
Use
from transformers import pipeline
classify = pipeline("text-classification", model="dfordebarati/email-urgency-roberta")
classify("The payment server is down and customers can't check out. Need someone on this now.")
Limitations
- 91 of the 114 test emails are LOW, so accuracy flatters the model. Macro-F1, which weighs the three levels equally, is the fairer number. Only 7 test emails are HIGH.
- 499 training emails from one company in the early 2000s. Other workplaces word urgency differently.
- The labels were drafted with a language model and then reviewed by hand against a written labelling guide. Some may still be wrong.
- English only. Anything past 128 tokens is cut off.
- Downloads last month
- -