BioBERT Embeddings (Clinical)

Description

This model contains a pre-trained weights of ClinicalBERT for generic clinical text. This domain-specific model has performance improvements on 3/5 clinical NLP tasks andd establishing a new state-of-the-art on the MedNLI dataset. The details are described in the paper “Publicly Available Clinical BERT Embeddings”.

Download Copy S3 URI

How to use


embeddings = BertEmbeddings.pretrained("biobert_clinical_base_cased", "en") \
.setInputCols("sentence", "token") \
.setOutputCol("embeddings")
nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, tokenizer, embeddings])
pipeline_model = nlp_pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))
result = pipeline_model.transform(spark.createDataFrame([['I hate cancer']], ["text"]))

val embeddings = BertEmbeddings.pretrained("biobert_clinical_base_cased", "en")
.setInputCols("sentence", "token")
.setOutputCol("embeddings")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, tokenizer, embeddings))
val data = Seq("I hate cancer").toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu

text = ["I hate cancer"]
embeddings_df = nlu.load('en.embed.biobert.clinical_base_cased').predict(text, output_level='token')
embeddings_df

Results

token	en_embed_biobert_clinical_base_cased_embeddings
		
I	          [0.2206662893295288, 0.41324421763420105, -0.3...
hate	    [-0.19311018288135529, 0.6037888526916504, -0....
cancer	    [0.2895708680152893, 0.22499887645244598, -0.5...

Model Information

Model Name: biobert_clinical_base_cased
Type: embeddings
Compatibility: Spark NLP 2.6.0
License: Open Source
Edition: Official
Input Labels: [sentence, token]
Output Labels: [word_embeddings]
Language: [en]
Dimension: 768
Case sensitive: true

Data Source

The model is imported from https://github.com/EmilyAlsentzer/clinicalBERT