Mouli36's picture
Upload folder using huggingface_hub
0fdd7d8 verified
|
Raw History Blame Contribute Delete
2.99 kB
# Email Intent and Priority Detection with DistilBERT
A Hugging Face-ready multi-task NLP project that classifies Enron emails into:
- **Intent**: Meeting Request, Action Required, Info Sharing, Follow-up, Approval Request, Complaint
- **Priority**: High, Medium, Low
This project uses **DistilBERT** with two classification heads on top of a shared encoder.
## Model Card Summary
- **Task**: Multi-label text classification (multi-task: intent + priority)
- **Language**: English
- **Dataset**: Enron Email Dataset
- **Architecture**: DistilBERT backbone + separate intent and priority heads
- **Framework**: PyTorch / Transformers
## Intended Use
This model is designed for email triage and message understanding. It can help classify incoming emails by topic and urgency.
## Limitations
- Labels are generated using **weak supervision**, not manual annotation.
- Performance may drop on emails outside the Enron style or vocabulary.
- The model is best suited for research and experimentation unless further fine-tuned with human-labeled data.
## Training Details
The notebook performs the following steps:
1. Parse raw Enron emails into structured text fields.
2. Clean subjects and bodies.
3. Generate pseudo-labels using rule-based patterns.
4. Balance the dataset with sampling.
5. Tokenize text using `distilbert-base-uncased`.
6. Train a shared DistilBERT encoder with two heads.
7. Evaluate on a held-out test set.
## Performance
Reported test results from the notebook:
- **Intent F1**: 0.8047
- **Priority F1**: 0.8845
- **Intent Accuracy**: about 0.80
- **Priority Accuracy**: about 0.88
## Files in This Repository
- `enron_final.ipynb` — training and evaluation notebook
- `README.md` — project overview
- `output/` — saved model and plots
## Inference Example
Input:
- Subject: `URGENT Please sign the contract by EOD today`
- Body: `This is time-sensitive. Please review and sign immediately.`
Expected output:
- Intent: `Action Required`
- Priority: `High`
## Usage
### 1. Install dependencies
```bash
pip install transformers safetensors torch scikit-learn pandas numpy matplotlib seaborn tqdm
```
### 2. Run the notebook
Open the notebook in Google Colab or Jupyter and execute all cells in order.
### 3. Load the saved model
Use the saved `bestmodel.safetensors`, tokenizer files, and `labelmaps.json` for inference.
## Hugging Face Deployment Notes
If you want to publish this project on Hugging Face:
- Add a `README.md` model card like this one.
- Include the trained weights and tokenizer files.
- Provide a small inference script or pipeline example.
- Mention that labels are pseudo-labeled and not manually annotated.
## Citation
If you use this project in a report or demo, cite it as:
- **Email Intent and Priority Detection using DistilBERT**
## Code Submission Instructions
For submission, you may either:
- Attach the code as a PDF export, or
- Include the Google Colab link with edit access or view access enabled.