Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -7,14 +7,15 @@ tags:
|
|
| 7 |
- icd-10
|
| 8 |
- multi-label-classification
|
| 9 |
- russian
|
| 10 |
-
|
|
|
|
| 11 |
pipeline_tag: text-classification
|
| 12 |
---
|
| 13 |
|
| 14 |
-
# ICD-10 subgroup classifier
|
| 15 |
|
| 16 |
-
Multi-label classifier over 3-character ICD-10 subgroups inside chapter **E**.
|
| 17 |
-
|
| 18 |
|
| 19 |
## Intended use / Назначение
|
| 20 |
- **EN:** Decision-support signal for suggesting candidate ICD-10 subgroups from Russian clinical notes. **Not** a substitute for clinician judgment; not validated for autonomous diagnosis.
|
|
@@ -23,29 +24,30 @@ Fine-tuned from [`ai-forever/ruBert-base`](https://huggingface.co/ai-forever/ruB
|
|
| 23 |
## Training data / Обучающие данные
|
| 24 |
- Source CSV: `datasets/subgroups/group_E.csv`
|
| 25 |
- SHA-256: `7bd98fc0eea937b8edf1391e86ca15afd2aed5c98996951f822684805713ed0b`
|
| 26 |
-
- Produced by `ml/build_subgroup_datasets.ipynb` (iterative multi-label stratification by `parse_id`).
|
| 27 |
- Splits: train=919 · val=200 · test=199
|
| 28 |
-
- Labels: 45
|
| 29 |
|
| 30 |
-
##
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
| hit@1 | 0.6432 |
|
| 38 |
-
| hit@3 | 0.8141 |
|
| 39 |
-
| recall@3 | 0.8047 |
|
| 40 |
-
| mrr | 0.7459 |
|
| 41 |
|
| 42 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
|
| 44 |
-
|
| 45 |
-
- Russian only; heavy reliance on clinical abbreviations (АД, ТТГ, УЗИ, etc.).
|
| 46 |
-
- Training text had PII redacted (`*ДАТА*`, `*ГОРОД*`, ...); model may behave differently on non-redacted input.
|
| 47 |
-
- Small chapters (train rows < 250) were trained with heavy regularization; some labels may have low support.
|
| 48 |
-
- Rare labels without positives in train are kept in the label map (see `label_map.json → rare_label_ids`) for interface stability but will effectively never fire.
|
| 49 |
|
| 50 |
## Inference
|
| 51 |
```python
|
|
@@ -62,12 +64,9 @@ inp = tok(text, return_tensors="pt", truncation=True, max_length=512)
|
|
| 62 |
with torch.no_grad():
|
| 63 |
probs = torch.sigmoid(mdl(**inp).logits)[0]
|
| 64 |
preds = [mdl.config.id2label[i] for i, p in enumerate(probs.tolist()) if p >= 0.5]
|
| 65 |
-
|
| 66 |
[(mdl.config.id2label[i], p) for i, p in enumerate(probs.tolist())],
|
| 67 |
key=lambda x: -x[1],
|
| 68 |
-
)[:
|
| 69 |
-
print(preds,
|
| 70 |
```
|
| 71 |
-
|
| 72 |
-
## Citation / Ссылка
|
| 73 |
-
Built as part of the `ai-app` ICD-10 classification pipeline. Upstream model: `ai-forever/ruBert-base` (ai-forever).
|
|
|
|
| 7 |
- icd-10
|
| 8 |
- multi-label-classification
|
| 9 |
- russian
|
| 10 |
+
- conditional-distillation
|
| 11 |
+
base_model: alexyalunin/RuBioBERT
|
| 12 |
pipeline_tag: text-classification
|
| 13 |
---
|
| 14 |
|
| 15 |
+
# ICD-10 subgroup classifier - group E (distilled specialist)
|
| 16 |
|
| 17 |
+
Multi-label classifier over 3-character ICD-10 subgroups inside chapter **E**.
|
| 18 |
+
This specialist was distilled from local BERT teacher models into `alexyalunin/RuBioBERT`. Teacher weights are not uploaded to Hugging Face.
|
| 19 |
|
| 20 |
## Intended use / Назначение
|
| 21 |
- **EN:** Decision-support signal for suggesting candidate ICD-10 subgroups from Russian clinical notes. **Not** a substitute for clinician judgment; not validated for autonomous diagnosis.
|
|
|
|
| 24 |
## Training data / Обучающие данные
|
| 25 |
- Source CSV: `datasets/subgroups/group_E.csv`
|
| 26 |
- SHA-256: `7bd98fc0eea937b8edf1391e86ca15afd2aed5c98996951f822684805713ed0b`
|
|
|
|
| 27 |
- Splits: train=919 · val=200 · test=199
|
| 28 |
+
- Labels: 45; rare/interface-only ids are listed in `label_map.json`.
|
| 29 |
|
| 30 |
+
## Training route
|
| 31 |
+
- Approach: `local_teacher_ensemble_knowledge_distillation`
|
| 32 |
+
- Base model: `alexyalunin/RuBioBERT`
|
| 33 |
+
- Direct validation hit@3: `0.835`
|
| 34 |
+
- No-distillation threshold: `0.9`
|
| 35 |
+
- Teacher models (fallback KD only): `['alexyalunin/RuBioRoBERTa', 'ai-forever/ruBert-base', 'DeepPavlov/rubert-base-cased']`
|
| 36 |
+
- Selected KD config (fallback only): temperature=`2.0`, hard_loss_weight=`0.5`
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
|
| 38 |
+
## Metrics (test split)
|
| 39 |
+
| metric | final specialist | teacher ensemble / fallback |
|
| 40 |
+
|---|---:|---:|
|
| 41 |
+
| macro_f1 | 0.6122 | 0.6805 |
|
| 42 |
+
| micro_f1 | 0.5606 | 0.6541 |
|
| 43 |
+
| weighted_f1 | 0.5830 | 0.6549 |
|
| 44 |
+
| subset_accuracy | 0.2965 | 0.4824 |
|
| 45 |
+
| hit@1 | 0.6482 | 0.6784 |
|
| 46 |
+
| hit@3 | 0.8241 | 0.8442 |
|
| 47 |
+
| recall@3 | 0.8147 | 0.8382 |
|
| 48 |
+
| mrr | 0.7516 | 0.7735 |
|
| 49 |
|
| 50 |
+
Full per-label breakdown is available in `metrics.json`.
|
|
|
|
|
|
|
|
|
|
|
|
|
| 51 |
|
| 52 |
## Inference
|
| 53 |
```python
|
|
|
|
| 64 |
with torch.no_grad():
|
| 65 |
probs = torch.sigmoid(mdl(**inp).logits)[0]
|
| 66 |
preds = [mdl.config.id2label[i] for i, p in enumerate(probs.tolist()) if p >= 0.5]
|
| 67 |
+
top5 = sorted(
|
| 68 |
[(mdl.config.id2label[i], p) for i, p in enumerate(probs.tolist())],
|
| 69 |
key=lambda x: -x[1],
|
| 70 |
+
)[:5]
|
| 71 |
+
print(preds, top5)
|
| 72 |
```
|
|
|
|
|
|
|
|
|