模型:
该模型是基于RoBERTa的模型,从荷兰电子病历中获取的数据进行了从头开始的微调。创建MedRoBERTa.nl的所有代码可以在 https://github.com/cltl-students/verkijk_stella_rma_thesis_dutch_medical_language_model 中找到。与否定情感识别任务相关的出版物可以在 https://arxiv.org/abs/2209.00470 找到。模型微调的代码可以在 https://github.com/umcu/negation-detection 找到。
tokenizer = AutoTokenizer\
.from_pretrained("UMCU/MedRoBERTa.nl_NegationDetection")
model = AutoModelForTokenClassification\
.from_pretrained("UMCU/MedRoBERTa.nl_NegationDetection")
some_text = "De patient was niet aanspreekbaar en hij zag er grauw uit. \
Hij heeft de inspanningstest echter goed doorstaan."
inputs = tokenizer(some_text, return_tensors='pt')
output = model.forward(inputs)
probas = torch.nn.functional.softmax(output.logits[0]).detach().numpy()
# koppel aan tokens
input_tokens = tokenizer.convert_ids_to_tokens(inputs['input_ids'][0])
target_map = {0: 'B-Negated', 1:'B-NotNegated',2:'I-Negated',3:'I-NotNegated'}
results = [{'token': input_tokens[idx],
'proba_negated': proba_arr[0]+proba_arr[2],
'proba_not_negated': proba_arr[1]+proba_arr[3]
}
for idx,proba_arr in enumerate(probas)]
值得注意的是,我们假设了 Inside-Outside-Beginning 的格式。
该模型通过微调用于荷兰临床文本的否定情感识别。由于它是在医疗数据上训练的领域特定模型,适用于荷兰语的医疗自然语言处理任务。该模型训练在距离待否定概念的512最大标记窗口上。请注意,我们还训练了一个双向LSTM,可以与 MedCAT 结合使用。
预训练模型是在阿姆斯特丹大学医学中心的近1000万份医院笔记上进行的训练。在开始预训练过程之前,训练数据已进行了匿名处理。
微调是在Erasmus荷兰临床语料库(EDCC)上进行的,可以通过Jan Kors(j.kors@erasmusmc.nl)获得。关于EDCC的描述在这里: https://bmcbioinformatics.biomedcentral.com/articles/10.1186/s12859-014-0373-3
MedRoBERTa.nl:Stella Verkijk,Piek Vossen,微调:Bram van Es,Sebastiaan Arends。
如果您在使用该模型时遇到问题,请在我们的git上提交一个问题: https://github.com/umcu/negation-detection/issues
如果您在您的工作中使用了该模型,请参考 https://doi.org/10.5281/zenodo.6980076 或 https://doi.org/10.48550/arXiv.2209.00470
论文:Verkijk, S. & Vossen, P. (2022) MedRoBERTa.nl: A Language Model for Dutch Electronic Health Records. Computational Linguistics in the Netherlands Journal, 11.
论文:Bram van Es, Leon C. Reteig, Sander C. Tan, Marijn Schraagen, Myrthe M. Hemker, Sebastiaan R.S. Arends, Miguel A.R. Rios, Saskia Haitjema (2022): Negation detection in Dutch clinical texts: an evaluation of rule-based and machine learning methods, Arxiv