AkshatSurolia
commited on
Commit
•
831fbb7
1
Parent(s):
30847ee
Update README.md
Browse files
README.md
CHANGED
@@ -1,33 +1,31 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
tags:
|
4 |
-
- text-classification
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
results = output.logits.detach().cpu().numpy()[0].argsort()[::-1][:5]
|
33 |
return [ config.id2label[ids] for ids in results]
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
tags:
|
4 |
+
- text-classification
|
5 |
+
---
|
6 |
+
|
7 |
+
# Clinical BERT for ICD-10 Prediction
|
8 |
+
|
9 |
+
The Publicly Available Clinical BERT Embeddings paper contains four unique clinicalBERT models: initialized with BERT-Base (cased_L-12_H-768_A-12) or BioBERT (BioBERT-Base v1.0 + PubMed 200K + PMC 270K) & trained on either all MIMIC notes or only discharge summaries.
|
10 |
+
|
11 |
+
---
|
12 |
+
|
13 |
+
## How to use the model
|
14 |
+
|
15 |
+
Load the model via the transformers library:
|
16 |
+
|
17 |
+
from transformers import AutoTokenizer, BertForSequenceClassification
|
18 |
+
tokenizer = AutoTokenizer.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
|
19 |
+
model = BertForSequenceClassification.from_pretrained("AkshatSurolia/ICD-10-Code-Prediction")
|
20 |
+
config = model.config
|
21 |
+
|
22 |
+
Run the model with clinical diagonosis text:
|
23 |
+
|
24 |
+
text = "subarachnoid hemorrhage scalp laceration service: surgery major surgical or invasive"
|
25 |
+
encoded_input = tokenizer(text, return_tensors='pt')
|
26 |
+
output = model(**encoded_input)
|
27 |
+
|
28 |
+
Return the Top-5 predicted ICD-10 codes:
|
29 |
+
|
30 |
+
results = output.logits.detach().cpu().numpy()[0].argsort()[::-1][:5]
|
|
|
|
|
31 |
return [ config.id2label[ids] for ids in results]
|