hsilvosa/aemps-cima
Viewer • Updated • 1.17M • 51
Fine-tuned dccuchile/bert-base-spanish-wwm-cased (BETO) that maps a Spanish drug description (name, dose, dosage form, active ingredients, route) to its ATC level-1 anatomical group (single-label, 14 classes). Levels 2-5 are not modelled. Training code: src/train_atc_classifier.py.
Held-out test set: 7996 rows (2518 unique texts), split by active-ingredient set. No ingredient combination in the test set appears in training.
| Metric | Value |
|---|---|
| Top-1 accuracy | 79.3% |
| Top-3 accuracy | 87.7% |
| Macro F1 | 0.691 |
Limits:
Intended only for medical research and pharmaceutical data analytics. Not for clinical prescribing or medical advice.
from transformers import AutoTokenizer, AutoModelForSequenceClassification
import torch
repo = "hsilvosa/BETO-ATC-Classifier"
tokenizer = AutoTokenizer.from_pretrained(repo)
model = AutoModelForSequenceClassification.from_pretrained(repo)
text = "Medicamento: Omeprazol 20 mg | Forma farmacéutica: COMPRIMIDO | Principios activos: Omeprazol"
inputs = tokenizer(text, return_tensors="pt")
probs = torch.softmax(model(**inputs).logits, dim=-1)
print(probs)
Base model
dccuchile/bert-base-spanish-wwm-cased