Description
This model extracts mentions of biomarkers and biomarker results from oncology texts. During training, a doc-wise method was used. This method processes a CoNLL-formatted dataset into structured sections designed for enhanced contextual analysis in tasks like Named Entity Recognition.
Definitions of Predicted Entities:
Biomarker
: Biological molecules that indicate the presence or absence of cancer, or the type of cancer (including oncogenes).Biomarker_Result
: Terms or values that are identified as the result of a biomarkers.
Predicted Entities
Biomarker
, Biomarker_Result
How to use
document_assembler = DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("document")
sentence_detector = SentenceDetectorDLModel.pretrained("sentence_detector_dl_healthcare","en","clinical/models")\
.setInputCols(["document"])\
.setOutputCol("sentence")
tokenizer = Tokenizer() \
.setInputCols(["sentence"]) \
.setOutputCol("token")
word_embeddings = WordEmbeddingsModel().pretrained("embeddings_clinical", "en", "clinical/models")\
.setInputCols(["sentence", "token"]) \
.setOutputCol("embeddings")
ner = MedicalNerModel.pretrained("ner_oncology_biomarker_docwise", "en", "clinical/models")\
.setInputCols(["sentence", "token", "embeddings"]) \
.setOutputCol("ner")
ner_converter = NerConverterInternal() \
.setInputCols(["sentence", "token", "ner"]) \
.setOutputCol("ner_chunk")
pipeline = Pipeline(stages=[document_assembler,
sentence_detector,
tokenizer,
word_embeddings,
ner,
ner_converter])
data = spark.createDataFrame([["""The results of immunohistochemical examination showed that she tested negative for CK7, synaptophysin (Syn), chromogranin A (CgA), Muc5AC, human epidermal growth factor receptor-2 (HER2), and Muc6; positive for CK20, Muc1, Muc2, E-cadherin, and p53; the Ki-67 index was about 87%."""]]).toDF("text")
result = pipeline.fit(data).transform(data)
document_assembler = nlp.DocumentAssembler()\
.setInputCol("text")\
.setOutputCol("document")
sentence_detector = nlp.SentenceDetectorDLModel.pretrained("sentence_detector_dl_healthcare","en","clinical/models")\
.setInputCols(["document"])\
.setOutputCol("sentence")
tokenizer = nlp.Tokenizer() \
.setInputCols(["sentence"]) \
.setOutputCol("token")
word_embeddings = nlp.WordEmbeddingsModel().pretrained("embeddings_clinical", "en", "clinical/models")\
.setInputCols(["sentence", "token"]) \
.setOutputCol("embeddings")
ner = medical.NerModel.pretrained("ner_oncology_biomarker_docwise", "en", "clinical/models")\
.setInputCols(["sentence", "token", "embeddings"]) \
.setOutputCol("ner")
ner_converter = medical.NerConverterInternal() \
.setInputCols(["sentence", "token", "ner"]) \
.setOutputCol("ner_chunk")
pipeline = nlp.Pipeline().setStages([document_assembler,
sentence_detector,
tokenizer,
word_embeddings,
ner,
ner_converter])
data = spark.createDataFrame([["""The results of immunohistochemical examination showed that she tested negative for CK7, synaptophysin (Syn), chromogranin A (CgA), Muc5AC, human epidermal growth factor receptor-2 (HER2), and Muc6; positive for CK20, Muc1, Muc2, E-cadherin, and p53; the Ki-67 index was about 87%."""]]).toDF("text")
result = pipeline.fit(data).transform(data)
val document_assembler = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val sentence_detector = SentenceDetectorDLModel.pretrained("sentence_detector_dl_healthcare","en","clinical/models")
.setInputCols("document")
.setOutputCol("sentence")
val tokenizer = new Tokenizer()
.setInputCols("sentence")
.setOutputCol("token")
val word_embeddings = WordEmbeddingsModel().pretrained("embeddings_clinical", "en", "clinical/models")
.setInputCols(Array("sentence", "token"))
.setOutputCol("embeddings")
val ner = MedicalNerModel.pretrained("ner_oncology_biomarker_docwise", "en", "clinical/models")
.setInputCols(Array("sentence", "token", "embeddings"))
.setOutputCol("ner")
val ner_converter = new NerConverterInternal()
.setInputCols(Array("sentence", "token", "ner"))
.setOutputCol("ner_chunk")
val pipeline = new Pipeline().setStages(Array(document_assembler,
sentence_detector,
tokenizer,
word_embeddings,
ner,
ner_converter))
val data = Seq([["""The results of immunohistochemical examination showed that she tested negative for CK7, synaptophysin (Syn), chromogranin A (CgA), Muc5AC, human epidermal growth factor receptor-2 (HER2), and Muc6; positive for CK20, Muc1, Muc2, E-cadherin, and p53; the Ki-67 index was about 87%."""]]).toDF("text")
val result = pipeline.fit(data).transform(data)
Results
+----------------------------------------+-----+---+----------------+
|chunk |begin|end|ner_label |
+----------------------------------------+-----+---+----------------+
|negative |70 |77 |Biomarker_Result|
|CK7 |83 |85 |Biomarker |
|synaptophysin |88 |100|Biomarker |
|Syn |103 |105|Biomarker |
|chromogranin A |109 |122|Biomarker |
|CgA |125 |127|Biomarker |
|Muc5AC |131 |136|Biomarker |
|human epidermal growth factor receptor-2|139 |178|Biomarker |
|HER2 |181 |184|Biomarker |
|Muc6 |192 |195|Biomarker |
|positive |198 |205|Biomarker_Result|
|CK20 |211 |214|Biomarker |
|Muc1 |217 |220|Biomarker |
|Muc2 |223 |226|Biomarker |
|E-cadherin |229 |238|Biomarker |
|p53 |245 |247|Biomarker |
|Ki-67 index |254 |264|Biomarker |
|87%. |276 |279|Biomarker_Result|
+----------------------------------------+-----+---+----------------+
Model Information
Model Name: | ner_oncology_biomarker_docwise |
Compatibility: | Healthcare NLP 5.5.1+ |
License: | Licensed |
Edition: | Official |
Input Labels: | [sentence, token, embeddings] |
Output Labels: | [ner] |
Language: | en |
Size: | 2.8 MB |
Benchmarking
label precision recall f1-score support
Biomarker 0.93 0.92 0.92 3278
Biomarker_Result 0.88 0.83 0.86 2203
micro-avg 0.91 0.88 0.90 5481
macro-avg 0.90 0.87 0.89 5481
weighted-avg 0.91 0.88 0.90 5481