BETO ATC Level-1 Classifier

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.

Evaluation

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:

  • One split seed was run, so the variation between seeds is unknown.
  • Class P (antiparasitics, 143 rows in total) has no rows in the test set and is not measured.
  • The dataset has one row per medicine presentation, so many rows repeat. A random row split gives about 99.9% accuracy because almost every test text also appears in training. Do not read that number as generalisation.
  • The model predicts the ATC group from the description. It does not replace the official AEMPS classification.

Intended Use & Disclaimer

Intended only for medical research and pharmaceutical data analytics. Not for clinical prescribing or medical advice.

Usage

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)
Downloads last month
14
Safetensors
Model size
0.1B params
Tensor type
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for hsilvosa/BETO-ATC-Classifier

Finetuned
(202)
this model

Dataset used to train hsilvosa/BETO-ATC-Classifier