BioBERT Sentence 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 = BertSentenceEmbeddings.pretrained("sent_biobert_clinical_base_cased", "en") \
.setInputCols("sentence") \
.setOutputCol("sentence_embeddings")
nlp_pipeline = Pipeline(stages=[document_assembler, sentence_detector, embeddings])
pipeline_model = nlp_pipeline.fit(spark.createDataFrame([[""]]).toDF("text"))
result = pipeline_model.transform(spark.createDataFrame([['I hate cancer', "Antibiotics aren't painkiller"]], ["text"]))
...
val embeddings = BertSentenceEmbeddings.pretrained("sent_biobert_clinical_base_cased", "en")
.setInputCols("sentence")
.setOutputCol("sentence_embeddings")
val pipeline = new Pipeline().setStages(Array(document_assembler, sentence_detector, embeddings))
val data = Seq("I hate cancer, "Antibiotics aren't painkiller").toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu

text = ["I hate cancer", "Antibiotics aren't painkiller"]
embeddings_df = nlu.load('en.embed_sentence.biobert.clinical_base_cased').predict(text, output_level='sentence')
embeddings_df

Results

sentence	                      en_embed_sentence_biobert_clinical_base_cased_embeddings
	
	I hate cancer	                [0.397987425327301, 0.6472950577735901, -0.551...
	Antibiotics aren't painkiller	    [0.19467104971408844, 0.3496762812137604, -0.3...

Model Information

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

Data Source

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