This is a named entity recognition model fine-tuned from the
microsoft/BiomedNLP-BiomedBERT-base-uncased-abstract-fulltext model. It predicts spans with 10 possible labels. The labels are
AcidChange, CellLine, DNAAllele, DNAMutation, Gene, OtherMutation, ProteinAllele, ProteinMutation, SNP and Species.
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.
1from transformers import pipeline
2
3# Load the model as part of an NER pipeline
4ner_pipeline = pipeline("token-classification",
5 model="Glasgow-AI4BioMed/bioner_tmvar3",
6 aggregation_strategy="max")
7
8# Apply it to some text
9ner_pipeline("The G1706A mutation is one of the most common variant in the BRCA1 gene.")
10
11# Output:
12# [ {"entity_group": "DNAMutation", "score": 0.99731, "word": "g1706a", "start": 4, "end": 10},
13# {"entity_group": "Gene", "score": 0.99795, "word": "brca1", "start": 61, "end": 66} ]
Source: The tmVar3 dataset was downloaded from:
https://ftp.ncbi.nlm.nih.gov/pub/lu/tmVar3/
The dataset should be cited with: Wei, Chih-Hsuan, et al. "tmVar 3.0: an improved variant concept recognition and normalization tool." Bioinformatics 38.18 (2022): 4449-4451. DOI:
10.1093/bioinformatics/btac537
Preprocessing: The training/validation/test split was maintained from the original dataset. No changes were made to the annotations. The preprocessing script for this dataset is
prepare_tmvar.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).
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.