Update README.md
Browse files
README.md
CHANGED
|
@@ -1,199 +1,88 @@
|
|
| 1 |
---
|
| 2 |
-
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 4 |
---
|
| 5 |
|
| 6 |
-
#
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
| 10 |
|
|
|
|
| 11 |
|
| 12 |
-
##
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
| 17 |
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
|
| 20 |
-
|
| 21 |
-
- **Funded by [optional]:** [More Information Needed]
|
| 22 |
-
- **Shared by [optional]:** [More Information Needed]
|
| 23 |
-
- **Model type:** [More Information Needed]
|
| 24 |
-
- **Language(s) (NLP):** [More Information Needed]
|
| 25 |
-
- **License:** [More Information Needed]
|
| 26 |
-
- **Finetuned from model [optional]:** [More Information Needed]
|
| 27 |
|
| 28 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
|
| 30 |
-
|
| 31 |
|
| 32 |
-
-
|
| 33 |
-
- **Paper [optional]:** [More Information Needed]
|
| 34 |
-
- **Demo [optional]:** [More Information Needed]
|
| 35 |
|
| 36 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
-
|
| 39 |
|
| 40 |
-
|
| 41 |
|
| 42 |
-
|
| 43 |
|
| 44 |
-
|
| 45 |
|
| 46 |
-
|
|
|
|
|
|
|
| 47 |
|
| 48 |
-
|
| 49 |
|
| 50 |
-
[
|
|
|
|
|
|
|
| 51 |
|
| 52 |
-
##
|
| 53 |
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
[More Information Needed]
|
| 57 |
-
|
| 58 |
-
## Bias, Risks, and Limitations
|
| 59 |
-
|
| 60 |
-
<!-- This section is meant to convey both technical and sociotechnical limitations. -->
|
| 61 |
-
|
| 62 |
-
[More Information Needed]
|
| 63 |
-
|
| 64 |
-
### Recommendations
|
| 65 |
-
|
| 66 |
-
<!-- This section is meant to convey recommendations with respect to the bias, risk, and technical limitations. -->
|
| 67 |
-
|
| 68 |
-
Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. More information needed for further recommendations.
|
| 69 |
-
|
| 70 |
-
## How to Get Started with the Model
|
| 71 |
-
|
| 72 |
-
Use the code below to get started with the model.
|
| 73 |
-
|
| 74 |
-
[More Information Needed]
|
| 75 |
-
|
| 76 |
-
## Training Details
|
| 77 |
-
|
| 78 |
-
### Training Data
|
| 79 |
-
|
| 80 |
-
<!-- This should link to a Dataset Card, perhaps with a short stub of information on what the training data is all about as well as documentation related to data pre-processing or additional filtering. -->
|
| 81 |
-
|
| 82 |
-
[More Information Needed]
|
| 83 |
-
|
| 84 |
-
### Training Procedure
|
| 85 |
-
|
| 86 |
-
<!-- This relates heavily to the Technical Specifications. Content here should link to that section when it is relevant to the training procedure. -->
|
| 87 |
-
|
| 88 |
-
#### Preprocessing [optional]
|
| 89 |
-
|
| 90 |
-
[More Information Needed]
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
#### Training Hyperparameters
|
| 94 |
-
|
| 95 |
-
- **Training regime:** [More Information Needed] <!--fp32, fp16 mixed precision, bf16 mixed precision, bf16 non-mixed precision, fp16 non-mixed precision, fp8 mixed precision -->
|
| 96 |
-
|
| 97 |
-
#### Speeds, Sizes, Times [optional]
|
| 98 |
-
|
| 99 |
-
<!-- This section provides information about throughput, start/end time, checkpoint size if relevant, etc. -->
|
| 100 |
-
|
| 101 |
-
[More Information Needed]
|
| 102 |
-
|
| 103 |
-
## Evaluation
|
| 104 |
-
|
| 105 |
-
<!-- This section describes the evaluation protocols and provides the results. -->
|
| 106 |
-
|
| 107 |
-
### Testing Data, Factors & Metrics
|
| 108 |
-
|
| 109 |
-
#### Testing Data
|
| 110 |
-
|
| 111 |
-
<!-- This should link to a Dataset Card if possible. -->
|
| 112 |
-
|
| 113 |
-
[More Information Needed]
|
| 114 |
-
|
| 115 |
-
#### Factors
|
| 116 |
-
|
| 117 |
-
<!-- These are the things the evaluation is disaggregating by, e.g., subpopulations or domains. -->
|
| 118 |
-
|
| 119 |
-
[More Information Needed]
|
| 120 |
-
|
| 121 |
-
#### Metrics
|
| 122 |
-
|
| 123 |
-
<!-- These are the evaluation metrics being used, ideally with a description of why. -->
|
| 124 |
-
|
| 125 |
-
[More Information Needed]
|
| 126 |
-
|
| 127 |
-
### Results
|
| 128 |
-
|
| 129 |
-
[More Information Needed]
|
| 130 |
-
|
| 131 |
-
#### Summary
|
| 132 |
-
|
| 133 |
-
|
| 134 |
-
|
| 135 |
-
## Model Examination [optional]
|
| 136 |
-
|
| 137 |
-
<!-- Relevant interpretability work for the model goes here -->
|
| 138 |
-
|
| 139 |
-
[More Information Needed]
|
| 140 |
-
|
| 141 |
-
## Environmental Impact
|
| 142 |
-
|
| 143 |
-
<!-- Total emissions (in grams of CO2eq) and additional considerations, such as electricity usage, go here. Edit the suggested text below accordingly -->
|
| 144 |
-
|
| 145 |
-
Carbon emissions can be estimated using the [Machine Learning Impact calculator](https://mlco2.github.io/impact#compute) presented in [Lacoste et al. (2019)](https://arxiv.org/abs/1910.09700).
|
| 146 |
-
|
| 147 |
-
- **Hardware Type:** [More Information Needed]
|
| 148 |
-
- **Hours used:** [More Information Needed]
|
| 149 |
-
- **Cloud Provider:** [More Information Needed]
|
| 150 |
-
- **Compute Region:** [More Information Needed]
|
| 151 |
-
- **Carbon Emitted:** [More Information Needed]
|
| 152 |
-
|
| 153 |
-
## Technical Specifications [optional]
|
| 154 |
-
|
| 155 |
-
### Model Architecture and Objective
|
| 156 |
-
|
| 157 |
-
[More Information Needed]
|
| 158 |
-
|
| 159 |
-
### Compute Infrastructure
|
| 160 |
-
|
| 161 |
-
[More Information Needed]
|
| 162 |
-
|
| 163 |
-
#### Hardware
|
| 164 |
-
|
| 165 |
-
[More Information Needed]
|
| 166 |
-
|
| 167 |
-
#### Software
|
| 168 |
-
|
| 169 |
-
[More Information Needed]
|
| 170 |
-
|
| 171 |
-
## Citation [optional]
|
| 172 |
-
|
| 173 |
-
<!-- If there is a paper or blog post introducing the model, the APA and Bibtex information for that should go in this section. -->
|
| 174 |
-
|
| 175 |
-
**BibTeX:**
|
| 176 |
-
|
| 177 |
-
[More Information Needed]
|
| 178 |
-
|
| 179 |
-
**APA:**
|
| 180 |
-
|
| 181 |
-
[More Information Needed]
|
| 182 |
-
|
| 183 |
-
## Glossary [optional]
|
| 184 |
-
|
| 185 |
-
<!-- If relevant, include terms and calculations in this section that can help readers understand the model or model card. -->
|
| 186 |
-
|
| 187 |
-
[More Information Needed]
|
| 188 |
-
|
| 189 |
-
## More Information [optional]
|
| 190 |
-
|
| 191 |
-
[More Information Needed]
|
| 192 |
-
|
| 193 |
-
## Model Card Authors [optional]
|
| 194 |
-
|
| 195 |
-
[More Information Needed]
|
| 196 |
-
|
| 197 |
-
## Model Card Contact
|
| 198 |
-
|
| 199 |
-
[More Information Needed]
|
|
|
|
| 1 |
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language: en
|
| 4 |
+
tags:
|
| 5 |
+
- medical-device
|
| 6 |
+
- pharmacovigilance
|
| 7 |
+
- text-classification
|
| 8 |
+
- clinical-nlp
|
| 9 |
+
- bio-clinicalbert
|
| 10 |
+
- fda-maude
|
| 11 |
+
base_model: emilyalsentzer/Bio_ClinicalBERT
|
| 12 |
+
metrics:
|
| 13 |
+
- f1
|
| 14 |
---
|
| 15 |
|
| 16 |
+
# MAUDE Adverse Event Severity Classifier — Bio_ClinicalBERT (Phase 2)
|
| 17 |
|
| 18 |
+
## Model Description
|
| 19 |
|
| 20 |
+
Fine-tuned [Bio_ClinicalBERT](https://huggingface.co/emilyalsentzer/Bio_ClinicalBERT) classifier that assigns a severity label — **Death (D) / Injury (I) / Malfunction (M) / Other (O)** — to free-text adverse event narratives from the FDA's [MAUDE database](https://open.fda.gov/apis/device/event/).
|
| 21 |
|
| 22 |
+
This is **Phase 2** of a two-phase project. Phase 1 established a TF-IDF + Logistic Regression baseline; this model improves on that baseline specifically on the highest-stakes class (Death).
|
| 23 |
|
| 24 |
+
## Training Data
|
| 25 |
|
| 26 |
+
- 154,776 MAUDE records (post-cleaning, `UNKNOWN` labels dropped)
|
| 27 |
+
- Source: openFDA MAUDE API
|
| 28 |
+
- Class distribution is imbalanced (Death prevalence ≈8%); handled via inverse-frequency class weights in the loss function
|
| 29 |
|
| 30 |
+
## Training Procedure
|
| 31 |
|
| 32 |
+
| Parameter | Value |
|
| 33 |
+
|---|---|
|
| 34 |
+
| Base model | `emilyalsentzer/Bio_ClinicalBERT` |
|
| 35 |
+
| Pooling | `cls_mean_concat` ([CLS] + mean-pooled, 1536-dim head) |
|
| 36 |
+
| Max token length | 512 |
|
| 37 |
+
| Batch size | 16 (×2 GPUs, effective 32 with grad accumulation = 2) |
|
| 38 |
+
| Learning rate | 2e-5 (AdamW, 10% linear warmup) |
|
| 39 |
+
| Epochs | 3 |
|
| 40 |
+
| Class weights | Inverse-frequency, applied in CrossEntropyLoss |
|
| 41 |
+
| Hardware | Kaggle, 2× T4 GPU (DataParallel) |
|
| 42 |
+
| CV strategy | 5-fold StratifiedKFold, splits SHA1-fingerprinted for reproducibility |
|
| 43 |
+
| Early stopping | Patience = 1 epoch |
|
| 44 |
|
| 45 |
+
## Evaluation Results (5-fold CV)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 46 |
|
| 47 |
+
| Metric | Mean | Std |
|
| 48 |
+
|---|---|---|
|
| 49 |
+
| F1 weighted | 0.8691 | 0.0010 |
|
| 50 |
+
| F1 macro | 0.7727 | 0.0020 |
|
| 51 |
+
| F1 — Death | 0.8318 | 0.0076 |
|
| 52 |
+
| F1 — Injury | 0.8728 | 0.0015 |
|
| 53 |
+
| F1 — Malfunction | 0.9069 | 0.0016 |
|
| 54 |
+
| F1 — Other | 0.4794 | 0.0069 |
|
| 55 |
|
| 56 |
+
**Improvement over Phase 1 baseline:** weighted F1 +0.0207, Death-class F1 +0.0617 (+6.2 pp) — the Death-class lift is the primary result this phase targeted.
|
| 57 |
|
| 58 |
+
### Per-Fold Breakdown
|
|
|
|
|
|
|
| 59 |
|
| 60 |
+
| Fold | F1 Death | F1 Injury | F1 Malfunction | F1 Other | F1 Macro | F1 Weighted |
|
| 61 |
+
|---|---|---|---|---|---|---|
|
| 62 |
+
| 1 | 0.8346 | 0.8713 | 0.9048 | 0.4730 | 0.7709 | 0.8671 |
|
| 63 |
+
| 2 | 0.8364 | 0.8711 | 0.9092 | 0.4826 | 0.7748 | 0.8700 |
|
| 64 |
+
| 3 | **0.8418** | 0.8749 | 0.9056 | 0.4764 | 0.7747 | 0.8693 |
|
| 65 |
+
| 4 | 0.8249 | 0.8727 | 0.9081 | 0.4735 | 0.7698 | 0.8693 |
|
| 66 |
+
| 5 | 0.8212 | 0.8740 | 0.9065 | 0.4915 | 0.7733 | 0.8698 |
|
| 67 |
|
| 68 |
+
## Deployed Checkpoint
|
| 69 |
|
| 70 |
+
**Fold 3** is the checkpoint pushed to this Hub repo, selected because it achieved the highest **Death-class F1 (0.8418)** across all five folds — not the highest weighted or macro F1 (fold 2 leads on both of those). This is a deliberate choice: in this application, a false negative on the Death class (a death narrative misclassified as Injury/Malfunction/Other) is the most clinically consequential error, so fold selection was optimized against that specific risk rather than an aggregate score.
|
| 71 |
|
| 72 |
+
**Provenance note:** this selection rationale was reconstructed and documented retroactively. At the time of the original push to this Hub repo, no model card or commit message recorded the selection criterion. Future pushes will include this documentation at push time, not after the fact.
|
| 73 |
|
| 74 |
+
## Honest Limitations
|
| 75 |
|
| 76 |
+
- All folds peaked at the epoch-3 training cap — validation performance was still improving when training stopped due to patience=1. Extending training would likely add further gains; current numbers are conservative, not a ceiling.
|
| 77 |
+
- **Other-class F1 (≈0.48) is the weakest class by a wide margin.** This class is a small, semantically heterogeneous catch-all bucket rather than a coherent label, which limits how learnable it is regardless of further tuning. Treated as a known limitation, not an active optimization target for this phase.
|
| 78 |
+
- **This is a research prototype. It is not validated for, and must not be used for, clinical decision-making.**
|
| 79 |
|
| 80 |
+
## Links
|
| 81 |
|
| 82 |
+
- [GitHub repository](https://github.com/mukundisb/maude-nlp-classifier) — source code, CV splits, training scripts
|
| 83 |
+
- [Phase 1 Space](https://huggingface.co/spaces/mukundisb/maude-classifier) — TF-IDF baseline demo
|
| 84 |
+
- [Phase 2 Space](https://huggingface.co/spaces/mukundisb/maude-clinicalbert) — this model, live demo
|
| 85 |
|
| 86 |
+
## Author
|
| 87 |
|
| 88 |
+
Mukund Padmanabha — [LinkedIn](https://linkedin.com/in/mukund-padmanabha)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|