Fine-tuning BERT to classify COVID 19 tweets containing symptoms (2021)

Abstract: Twitter is a valuable source of patient-generated data that has been used in various population health studies. The first step in many of these studies is to identify and capture Twitter messages (tweets) containing medication mentions. Identifying personal mentions of COVID19 symptoms requires distinguishing personal mentions from other mentions such as symptoms reported by others and references to news articles or other sources. In this article, we describe our submission to Task 6 of the Social Media Mining for Health Applications (SMM4H) Shared Task 2021. This task challenged participants to classify tweets where the target classes are:(1) self-reports,(2) non-personal reports, and (3) literature/news mentions. Our system used a handcrafted preprocessing and word embeddings from BERT encoder model. We achieved an F1 score of 93%

## introduction the classification of medical symptoms from covid-19 twitter posts presents two key issues. firstly, there is plenty of discourse around news and scientific articles that describe medical symptoms. while this discourse is not related to any user in particular, it enhances the difficulty of identifying valuable user-reported information. secondly, many users describe symptoms that other people experience, instead of their own, as they are usually caregivers or relatives of people presenting the symptoms. this makes the task of separating what the user is self-reporting particularly tricky, as the discourse is not only around personal experiences. moreover, detecting tweets containing health-related words such as diseases, treatments and medications is a fundamental yet difficult step. these difficulties are exacerbated by the short length and informal nature of tweets, which often contain non-standard grammar, frequent misspellings, many contractions, extensive slang, and combined symbols (emojis/emoticons) to express emotion @xcite . from the types of class-labels that are to be predicted, it is clear that contextual representations play an important role beside semantics. recurrent models are typically used for this task which computes along the symbol positions of the input and output sequences. aligning the positions to steps in computation time, they generate a sequence of hidden states h t , as a function of the previous hidden state h t-1 and the input for position t. this inherently sequential nature precludes parallelization within training examples, which becomes critical at longer sequence lengths, as memory constraints limit batching across examples. earlier in context-representation there were two strategies for applying pre-trained language representations to downstream tasks: feature-based and fine-tuning. however, both are limited to the fact that they are unidirectional language models and are unable to learn general language representations. the latest advances in bidirectional encoder representations from transformers (bert) address both of these issues, as it is designed to pretrain deep bidirectional representations from unlabeled text by jointly conditioning on both left and right context in all layers @xcite . we have used small-bert preprocessing and encoding to get vector representation of sentences, and finetuned bert for the ternary classification task. ## data task 6 of smm4h shared task 2021 @xcite challenged participants to develop an automatic classification system to identify tweets mentioning (1) self-reports, (2) non-personal reports, and (3) literature/news mentions. the task was formulated as a multi-class classification task, in which given a set of tweets a system should predict the label for each tweet. the emojis were removed using python "emoji" library. hashtags, mentions (words beginning with @) and urls were also removed. ## results and analysis we obtained an f1 score of 0.968 on the validation set and 0.9325 on the test set (cf. on analysing the wrongly classified tweets in the validation set, we observed some interesting patterns. the sentence "me and my girl swear we have already had covid-19. we were sick for nearly a month, fever, cough, sore throat, the doctors told me i had the flu combined with bronchitis because some days i felt like i was drowning in chest mucus." was classified as self-report, while it is an ambiguous case of self-report and non-personal review. the misclasssification of the tweet "i had crippling body aches, fatigue and couldn't concentrate'was @tomhanksanother covid19 long-hauler? sounds v. familiar! longcovid @hadleyfreeman @guardian" was due to shortcoming of the preprocessing. this tweet is originally labelled as a lit-news, though it was classified as self report. the main reason is that after preprocesing all the hashtags and the mentions were removed; therefore the overall context the model understood was in first-person and hence it classified the tweet as a self report. ## conclusion we present a small bert based model with custom preprocessing to classify tweets containing covid-19 symptoms. we tested the model by adjusting various hyperparameters and presented the best result that we obtained using this model. we achieved f1 score of 93%. we observed that the preprocessing needed to include the mentions for some tweets for proper classification, though it was necessary to remove the mentions for the overall increase in the performance of the system.