| Literature DB >> 34330244 |
Feihong Yang1, Xuwen Wang1, Hetong Ma1, Jiao Li2.
Abstract
BACKGROUND: Transformer is an attention-based architecture proven the state-of-the-art model in natural language processing (NLP). To reduce the difficulty of beginning to use transformer-based models in medical language understanding and expand the capability of the scikit-learn toolkit in deep learning, we proposed an easy to learn Python toolkit named transformers-sklearn. By wrapping the interfaces of transformers in only three functions (i.e., fit, score, and predict), transformers-sklearn combines the advantages of the transformers and scikit-learn toolkits.Entities:
Keywords: Deep Learning; Medical Language Understanding; NLP; Toolkit; Transformer
Year: 2021 PMID: 34330244 PMCID: PMC8323195 DOI: 10.1186/s12911-021-01459-0
Source DB: PubMed Journal: BMC Med Inform Decis Mak ISSN: 1472-6947 Impact factor: 2.796
The common parameters of the Python classes in transformers-sklearn
| Name | Function |
|---|---|
| Specifies which type of model initialization style should be used | |
| Specifies which pre-trained model should be used | |
| Sets the max length of the sequence that could be accepted | |
| Sets the batch size per GPU | |
| Sets the learning rate of the model | |
| Sets the number of training epochs of the model | |
| Sets whether the GPU is used for training or predicting |
Fig. 1Workflow of using transformers-sklearn to address NLP problems
An example of the NER input data format in the BERTologyNERClassifier
| Input data field | Example |
|---|---|
| Text | […[“Naloxone”, “reverses”, “the”, “antihypertensive”, “effect”, “of”, “clonidine”, “.”], …] |
| Label | […[“B-Chem”, “O”, “O”, “O”, “O”, “O”, “B-Chem”,”O”], …] |
Pre-trained models and URLs
| Model | URL |
|---|---|
The open-source datasets of the four English and Chinese Medical NLP tasks
| Name | NLP Task | Language | Domain | Metric |
|---|---|---|---|---|
| TrialClassification [ | Classification | Chinese | Clinical Trial | |
| BC5CDR [ | NER | English | PubMed titles and abstracts | |
| DiabetesNER [ | NER | Chinese | Diabetes Papers | |
| BIOSSES [ | Regression | English | Biomedical |
The experimental results of transformers-sklearn, transformers and UER in four medical NLP tasks (mode_type = “bert”)
| Name | Score | Second | Lines of code | Pre-trained model | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Ours | UER | Ours | Transformers | UER | Ours | UER | ||||
| TrialClassification | 0.8225a | 0.8213a | 1198 | 1227 | 764 | 38 | 246 | 412 | ||
| BC5CDR | 0.8635a | - | 471 | 499 | - | 41 | 309 | - | ||
| DiabetesNER | 0.6908a | 0.6962a | 1254 | 1548 | 2805 | 63 | 309 | 372 | ||
| BIOSSES | 0.8200b | - | 19 | 15 | - | 41 | 246 | - | ||
aThe value of Macro F1, where the bolded one indicates the best performance.
bThe value of Person correlation, where the bolded one indicates the best performance.
The experimental results of transformers-sklearn and transformers in four medical NLP tasks (mode_type = “roberta”)
| Name | Score | Second | Lines of code | Pre-trained model | |||
|---|---|---|---|---|---|---|---|
| Ours | Ours | Transformers | Ours | ||||
| TrialClassification | 0.8148 | 1206 | 1208 | 38 | 246 | ||
| BC5CDR | 0.8461a | 460 | 504 | 41 | 309 | ||
| DiabetesNER | 0.7068a | 1445 | 1426 | 63 | 309 | ||
| BIOSSES | 0.3614b | 36 | 17 | 41 | 246 | ||
aThe value of Macro F1, where the bolded one indicates the best performance
bThe value of Person correlation, where the bolded one indicates the best performance
The experimental results of transformers-sklearn and transformers in four medical NLP tasks (mode_type = “albert”)
| Name | Score | Second | Lines of code | Pre-trained model | |||
|---|---|---|---|---|---|---|---|
| Ours | Ours | Transformers | Ours | ||||
| TrialClassification | 0.4504a | 1062 | 1068 | 38 | 246 | ||
| BC5CDR | 0.8422a | 444 | 492 | 41 | 309 | ||
| DiabetesNER | 0.6196a | 1122 | 1253 | 63 | 309 | ||
| BIOSSES | 0.1892b | 12 | 11 | 41 | 246 | ||
aThe value of Macro F1, where the bolded indicates the best performance
bThe value of Person correlation, where the bolded inidcates the best performance
Fig. 2The code for BIOSSES within transformers-sklearn