Description
This model is a BioBERT based sentimental analysis model that can extract information from COVID-19 Vaccine-related tweets. The model predicts whether a tweet contains positive, negative, or neutral sentiments about COVID-19 Vaccines.
Predicted Entities
neutral
, positive
, negative
Live Demo Open in Colab Copy S3 URI
How to use
document_assembler = DocumentAssembler() \
.setInputCol("text") \
.setOutputCol("document")
tokenizer = Tokenizer() \
.setInputCols(["document"]) \
.setOutputCol("token")
sequenceClassifier = MedicalBertForSequenceClassification.pretrained("bert_sequence_classifier_vaccine_sentiment", "en", "clinical/models")\
.setInputCols(["document","token"])\
.setOutputCol("class")
pipeline = Pipeline(stages=[
document_assembler,
tokenizer,
sequenceClassifier
])
text_list = ['A little bright light for an otherwise dark week. Thanks researchers, and frontline workers. Onwards.',
'People with a history of severe allergic reaction to any component of the vaccine should not take.',
'43 million doses of vaccines administrated worldwide...Production capacity of CHINA to reach 4 b']
data = spark.createDataFrame(text_list, StringType()).toDF("text")
result = pipeline.fit(data).transform(data)
val documenter = new DocumentAssembler()
.setInputCol("text")
.setOutputCol("document")
val tokenizer = new Tokenizer()
.setInputCols("document")
.setOutputCol("token")
val sequenceClassifier = MedicalBertForSequenceClassification.pretrained("bert_sequence_classifier_vaccine_sentiment", "en", "clinical/models")
.setInputCols(Array("document","token"))
.setOutputCol("class")
val pipeline = new Pipeline().setStages(Array(documenter, tokenizer, sequenceClassifier))
val data = Seq(Array("A little bright light for an otherwise dark week. Thanks researchers, and frontline workers. Onwards.",
"People with a history of severe allergic reaction to any component of the vaccine should not take.",
"43 million doses of vaccines administrated worldwide...Production capacity of CHINA to reach 4 b")).toDS.toDF("text")
val result = pipeline.fit(data).transform(data)
import nlu
nlu.load("en.classify.bert_sequence_vaccine_sentiment").predict("""A little bright light for an otherwise dark week. Thanks researchers, and frontline workers. Onwards.""")
Results
+-----------------------------------------------------------------------------------------------------+----------+
|text |class |
+-----------------------------------------------------------------------------------------------------+----------+
|A little bright light for an otherwise dark week. Thanks researchers, and frontline workers. Onwards.|[positive]|
|People with a history of severe allergic reaction to any component of the vaccine should not take. |[negative]|
|43 million doses of vaccines administrated worldwide...Production capacity of CHINA to reach 4 b |[neutral] |
+-----------------------------------------------------------------------------------------------------+----------+
Model Information
Model Name: | bert_sequence_classifier_vaccine_sentiment |
Compatibility: | Healthcare NLP 4.0.0+ |
License: | Licensed |
Edition: | Official |
Input Labels: | [document, token] |
Output Labels: | [class] |
Language: | en |
Size: | 406.5 MB |
Case sensitive: | true |
Max sentence length: | 128 |
References
Curated from several academic and in-house datasets.
Benchmarking
label precision recall f1-score support
neutral 0.82 0.78 0.80 1007
positive 0.88 0.90 0.89 1002
negative 0.83 0.86 0.84 881
accuracy - - 0.85 2890
macro-avg 0.85 0.85 0.85 2890
weighted-avg 0.85 0.85 0.85 2890