Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
datasets:
|
| 4 |
+
- ade-benchmark-corpus/ade_corpus_v2
|
| 5 |
+
language:
|
| 6 |
+
- en
|
| 7 |
+
base_model:
|
| 8 |
+
- dmis-lab/biobert-base-cased-v1.2
|
| 9 |
+
pipeline_tag: text-classification
|
| 10 |
+
tags:
|
| 11 |
+
- biomedical
|
| 12 |
+
- nlp
|
| 13 |
+
- adverse-drug-effects
|
| 14 |
+
- bert
|
| 15 |
+
- biobert
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# BioBERT for Adverse Drug Effect (ADE) Classification
|
| 19 |
+
|
| 20 |
+
This model is a fine-tuned version of [`dmis-lab/biobert-base-cased-v1.2`](https://huggingface.co/dmis-lab/biobert-base-cased-v1.2) for binary sentence classification: Does a sentence describe an **adverse drug effect (ADE)**?
|
| 21 |
+
It was fine-tuned on the [ADE Corpus V2](https://huggingface.co/datasets/ade-benchmark-corpus/ade_corpus_v2) dataset and compared against a classical TF-IDF + Logistic Regression baseline as part of a broader project benchmarking classical vs. transformer approaches on imbalanced biomedical text.
|
| 22 |
+
|
| 23 |
+
**Project Repo:** [GitHub](https://github.com/steven-cheun/nlp-ade-classification)
|
| 24 |
+
|
| 25 |
+
## Results (Test Set: N=3,528)
|
| 26 |
+
|
| 27 |
+
| Model | Weighted F1 | ADE Class F1 | Accuracy | Total Errors |
|
| 28 |
+
|---|---|---|---|---|
|
| 29 |
+
| TF-IDF + Logistic Regression | 0.90 | 0.84 | 90% | 349 |
|
| 30 |
+
| **BioBERT (this model)** | **0.96** | **0.93** | **96%** | **145** |
|
| 31 |
+
|
| 32 |
+
BioBERT reduced misclassifications by **58%** (349 → 145 errors) compared to the classical baseline.
|
| 33 |
+
|
| 34 |
+
## Training Details
|
| 35 |
+
|
| 36 |
+
- **Base model:** `dmis-lab/biobert-base-cased-v1.2` (110M parameters)
|
| 37 |
+
- **Epochs:** 3 (Best checckpoint selected by validation F1)
|
| 38 |
+
- **Learning rate:** 2e-5
|
| 39 |
+
- **Batch size:** 16
|
| 40 |
+
- **Max sequence length:** 128
|
| 41 |
+
- **Precision:** fp16
|
| 42 |
+
- **Data split:** stratified 70/15/15 train/val/test (seed=42)
|
| 43 |
+
|
| 44 |
+
| Epoch | Train Loss | Val F1 | Val Accuracy |
|
| 45 |
+
|---|---|---|---|
|
| 46 |
+
| 1 | 0.175 | 0.943 | 0.943 |
|
| 47 |
+
| 2 | 0.114 | 0.952 | 0.952 |
|
| 48 |
+
| 3 | 0.043 | 0.952 | 0.952 |
|
| 49 |
+
|
| 50 |
+
## Usage
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
from transformers import AutoModelForSequenceClassification, AutoTokenizer
|
| 54 |
+
|
| 55 |
+
model = AutoModelForSequenceClassification.from_pretrained("scheun/biobert-ade-classifier")
|
| 56 |
+
tokenizer = AutoTokenizer.from_pretrained("scheun/biobert-ade-classifier")
|
| 57 |
+
|
| 58 |
+
inputs = tokenizer("Patient developed severe nausea after taking the medication.", return_tensors="pt")
|
| 59 |
+
outputs = model(**inputs)
|
| 60 |
+
prediction = outputs.logits.argmax(-1).item()
|
| 61 |
+
print(prediction) # 0 = not ADE, 1 = ADE
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
## Limitations
|
| 65 |
+
|
| 66 |
+
- Trained on MEDLINE case report sentences. Performance may vary on other text domains.
|
| 67 |
+
- Binary classification only. It does not extract which drug or which effect is mentioned.
|
| 68 |
+
|
| 69 |
+
## References
|
| 70 |
+
|
| 71 |
+
- Gurulingappa et al. (2012), *Development of a benchmark corpus to support the automatic extraction of drug-related adverse effects from medical case reports*
|
| 72 |
+
- Lee et al. (2020), *BioBERT: a pre-trained biomedical language representation model for biomedical text mining*
|