Feature Extraction
Transformers
Safetensors
English
bert
text-classification
icd10
healthcare
medical
custom_code
text-embeddings-inference
Instructions to use UMCU/ICD10_classifier_base_English with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use UMCU/ICD10_classifier_base_English with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("feature-extraction", model="UMCU/ICD10_classifier_base_English", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForSequenceClassification tokenizer = AutoTokenizer.from_pretrained("UMCU/ICD10_classifier_base_English", trust_remote_code=True) model = AutoModelForSequenceClassification.from_pretrained("UMCU/ICD10_classifier_base_English", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,70 @@
|
|
| 1 |
---
|
| 2 |
license: agpl-3.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: agpl-3.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
base_model:
|
| 6 |
+
- cambridgeltl/SapBERT-from-PubMedBERT-fulltext
|
| 7 |
+
pipeline_tag: feature-extraction
|
| 8 |
+
datasets:
|
| 9 |
+
- FiscaAI/icd10cm-multilabel-prompt
|
| 10 |
+
metrics:
|
| 11 |
+
- name: f1 macro
|
| 12 |
+
type: f1
|
| 13 |
+
value: 0.65
|
| 14 |
+
- name: recall micro
|
| 15 |
+
type: recall
|
| 16 |
+
value: 0.76
|
| 17 |
+
- name: precision micro
|
| 18 |
+
type: precision
|
| 19 |
+
value: 0.65
|
| 20 |
+
- name: subset accuracy
|
| 21 |
+
type: set accuracy
|
| 22 |
+
value: 0.26
|
| 23 |
+
library_name: transformers
|
| 24 |
+
tags:
|
| 25 |
+
- icd10
|
| 26 |
+
- healthcare
|
| 27 |
+
- medical
|
| 28 |
---
|
| 29 |
+
|
| 30 |
+
We finetuned the SapBERT encoder model on the synthetic ICD10 set by [FiscaAI](https://huggingface.co/FiscaAI).
|
| 31 |
+
|
| 32 |
+
We trimmed the ICD10 codes to ```X##```, i.e. we trimmed the dot, and then kept only the ICD10 codes that had more than 1000 occurrences, after which we kept the texts that had at least
|
| 33 |
+
one of the remaining ICD10 codes, this resulted in close to 950 ICD10 codes uses as labels for the finetuning with about 700.000 samples.
|
| 34 |
+
|
| 35 |
+
We use multilabel finetuning with a head of 3 dense layers, with 10% dropout and GELU activation.
|
| 36 |
+
|
| 37 |
+
We used class weighting with log smoothing.
|
| 38 |
+
|
| 39 |
+
For the
|
| 40 |
+
|
| 41 |
+
TLDR;
|
| 42 |
+
* ICD10 trimmed after dot, A10.42 -> A10
|
| 43 |
+
* minimum_token_count=16
|
| 44 |
+
* minimum_label_count=1000
|
| 45 |
+
* sequence_length=256
|
| 46 |
+
* log-smoothed class weights
|
| 47 |
+
* 3 dense layers, 10% dropout, GELU
|
| 48 |
+
* 5 epochs
|
| 49 |
+
* batch size 16
|
| 50 |
+
* max learning rate 2e-5
|
| 51 |
+
* repeated linear warmup (10.000 steps) + cosine decay (50.000 steps)
|
| 52 |
+
|
| 53 |
+
When you load this model for feature extraction or classification use
|
| 54 |
+
|
| 55 |
+
```python
|
| 56 |
+
from transformers import AutoModelForSequenceClassification
|
| 57 |
+
|
| 58 |
+
model = AutoModelForSequenceClassification.from_pretrained(
|
| 59 |
+
"UMCU/ICD10_classifier_base_English",
|
| 60 |
+
trust_remote_code=True,
|
| 61 |
+
)
|
| 62 |
+
```
|
| 63 |
+
|
| 64 |
+
or
|
| 65 |
+
|
| 66 |
+
```python
|
| 67 |
+
from transformers import pipeline
|
| 68 |
+
|
| 69 |
+
le_pipe = pipeline('text-classification',trust_remote_code=True)
|
| 70 |
+
```
|