Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# 🤖 RoBERTa ADR Severity Classifier
|
| 2 |
+
|
| 3 |
+
This is a fine-tuned [RoBERTa](https://huggingface.co/roberta-base) model that detects **Adverse Drug Reactions (ADRs)** and classifies them as either **severe** (`1`) or **not severe** (`0`). It is trained on annotated ADR text data and is part of a broader NLP pipeline that extracts symptoms, diseases, and medications from biomedical reports.
|
| 4 |
+
|
| 5 |
+
---
|
| 6 |
+
|
| 7 |
+
## 🧠 Model Details
|
| 8 |
+
|
| 9 |
+
- **Base Model:** `roberta-base`
|
| 10 |
+
- **Task:** Binary Text Classification (`Severe` vs `Not Severe`)
|
| 11 |
+
- **Training Data:** 3,000+ annotated ADR descriptions
|
| 12 |
+
- **Framework:** Hugging Face Transformers + PyTorch
|
| 13 |
+
|
| 14 |
+
---
|
| 15 |
+
|
| 16 |
+
## 🔬 Intended Use
|
| 17 |
+
|
| 18 |
+
This model is intended for **research and educational purposes** in biomedical NLP. It can be used to:
|
| 19 |
+
|
| 20 |
+
- Flag potentially dangerous side effects in user-reported ADRs
|
| 21 |
+
- Prioritize ADR cases based on severity
|
| 22 |
+
- Serve as a backend for medical QA systems or healthcare apps
|
| 23 |
+
|
| 24 |
+
---
|
| 25 |
+
|
| 26 |
+
## 📈 Performance
|
| 27 |
+
|
| 28 |
+
Evaluated on a balanced test set of 1,623 samples:
|
| 29 |
+
|
| 30 |
+
| Metric | Class 0 (Not Severe) | Class 1 (Severe) |
|
| 31 |
+
|------------|----------------------|------------------|
|
| 32 |
+
| Precision | 0.904 | 0.880 |
|
| 33 |
+
| Recall | 0.865 | 0.915 |
|
| 34 |
+
| F1-Score | 0.884 | 0.897 |
|
| 35 |
+
| Accuracy | **0.891** | |
|
| 36 |
+
| AUC | **0.956** | |
|
| 37 |
+
|
| 38 |
+
---
|
| 39 |
+
|
| 40 |
+
## 🚀 Example Usage
|
| 41 |
+
|
| 42 |
+
```python
|
| 43 |
+
from transformers import AutoTokenizer, AutoModelForSequenceClassification
|
| 44 |
+
import torch
|
| 45 |
+
|
| 46 |
+
model = AutoModelForSequenceClassification.from_pretrained("calerio-uva/roberta-adr-model")
|
| 47 |
+
tokenizer = AutoTokenizer.from_pretrained("calerio-uva/roberta-adr-model")
|
| 48 |
+
|
| 49 |
+
text = "Severe migraine with vision loss and vomiting after taking ibuprofen."
|
| 50 |
+
inputs = tokenizer(text, return_tensors="pt", truncation=True, padding=True, max_length=512)
|
| 51 |
+
|
| 52 |
+
with torch.no_grad():
|
| 53 |
+
logits = model(**inputs).logits
|
| 54 |
+
probs = torch.softmax(logits, dim=1)
|
| 55 |
+
|
| 56 |
+
print(f"Not Severe: {probs[0][0]:.3f}, Severe: {probs[0][1]:.3f}")
|