Downloads · 30 days
1.1K
21% of all-time downloads
Glasgow-AI4BioMed/bioner_bc5cdr
bioner_bc5cdr is a machine learning model from Glasgow-AI4BioMed. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
This is a named entity recognition model fine-tuned from the microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext model. It predicts spans with 2 possible labels. The labels are Chemical and Disease.
Downloads · 30 days
1.1K
21% of all-time downloads
All-time downloads
5.5K
Public
Parameters
109M
436 MB on disk
Likes
0
Public
Click a slice to open those files.
.safetensors436 MB · 100%
From the Hugging Face model README
This is a named entity recognition model fine-tuned from the microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext model. It predicts spans with 2 possible labels. The labels are Chemical and Disease.
The code used for training this model can be found at https://github.com/Glasgow-AI4BioMed/bioner along with links to other biomedical NER models trained on well-known biomedical corpora. The source dataset information is below.
The code below will load up the model and apply it to the provided text. It uses a simple aggregation strategy to post-process the individual tokens into larger multi-token entities where needed.
from transformers import pipeline
# Load the model as part of an NER pipeline
ner_pipeline = pipeline("token-classification",
model="Glasgow-AI4BioMed/bioner_bc5cdr",
aggregation_strategy="max")
# Apply it to some text
ner_pipeline("EGFR T790M mutations have been known to affect treatment outcomes for NSCLC patients receiving erlotinib.")
# Output:
# [ {"entity_group": "Disease", "score": 0.99952, "word": "nsclc", "start": 51, "end": 56},
# {"entity_group": "Chemical", "score": 0.9995, "word": "erlotinib", "start": 76, "end": 85} ]
Source: The BC5CDR dataset was downloaded from: https://ftp.ncbi.nlm.nih.gov/pub/lu/BC5CDR/
The dataset should be cited with: Li, Jiao, et al. "BioCreative V CDR task corpus: a resource for chemical disease relation extraction." Database 2016 (2016). DOI: 10.1093/database/baw068
Preprocessing: The training/validation/test split was maintained from the original dataset. Non-contiguous annotations were removed and no other changes were made. The preprocessing script for this dataset is prepare_bc5cdr.py.
The span-level performance on the test split for the different labels are shown in the tables below. The full performance results are available in the model repo in Markdown format for viewing and JSON format for easier loading. These include the performance at token level (with individual B- and I- labels as the token classifier uses IOB2 token labelling).
| Label | Precision | Recall | F1-score | Support |
|---|---|---|---|---|
| Chemical | 0.927 | 0.925 | 0.926 | 5370 |
| Disease | 0.815 | 0.862 | 0.838 | 4486 |
| macro avg | 0.871 | 0.893 | 0.882 | 9856 |
| weighted avg | 0.876 | 0.896 | 0.886 | 9856 |
Hyperparameter tuning was done with optuna and the hyperparameter_search functionality. 100 trials were run. Early stopping was applied during training. The best performing model was selected using the macro F1 performance on the validation set. The selected hyperparameters are in the table below.
| Hyperparameter | Value |
|---|---|
| epochs | 7.0 |
| learning_rate | 6.150691546013236e-05 |
| per_device_train_batch_size | 8 |
| weight_decay | 0.02919246813677108 |
| warmup_ratio | 0.014555287490025246 |