Source-linked AI summary
COVID-19 Public Sentiment Insights and Machine Learning for Tweets Classification
Jim Samuel, G. G. Md. Nawaz Ali, Md. Mokhlesur Rahman, Ek Esawi, Yana Samuel
TL;DR
The paper addresses the need to understand COVID-19’s informational crisis and public sentiment amid fear and panic. It analyzes Coronavirus Tweets with sentiment and descriptive textual analytics, visualizations, and two machine-learning classifiers. Naïve Bayes reached 91% accuracy for short Tweets, while performance was weaker for longer Tweets.
Problem
The study addresses limited understanding of COVID-19 public sentiment and the need for rapid analytics of pandemic information flows.
Method
The paper analyzes Coronavirus-specific Tweets using sentiment analysis, descriptive textual analytics, visualizations, and Naïve Bayes and logistic classification methods.
Results
Naïve Bayes achieved 91% accuracy for short Tweets versus 74% for logistic regression, while both methods performed worse on longer Tweets.
Takeaways & Limitations
Twitter textual analytics identified rising fear sentiment and provided directional support for Naïve Bayes and logistic classification of short to medium Tweets.
Takeaways & Limitations
The Coronavirus-filtered Twitter corpus and single sentiment lexicons limit generalizability and the breadth of sentiment classification.
Abstract
from arXiv · showhide
Along with the Coronavirus pandemic, another crisis has manifested itself in the form of mass fear and panic phenomena, fueled by incomplete and often inaccurate information. There is therefore a tremendous need to address and better understand COVID-19's informational crisis and gauge public sentiment, so that appropriate messaging and policy decisions can be implemented. In this research article, we identify public sentiment associated with the pandemic using Coronavirus specific Tweets and R statistical software, along with its sentiment analysis packages. We demonstrate insights into the progress of fear-sentiment over time as COVID-19 approached peak levels in the United States, using descriptive textual analytics supported by necessary textual data visualizations. Furthermore, we provide a methodological overview of two essential machine learning (ML) classification methods, in the context of textual analytics, and compare their effectiveness in classifying Coronavirus Tweets of varying lengths. We observe a strong classification accuracy of 91% for short Tweets, with the Naive Bayes method. We also observe that the logistic regression classification method provides a reasonable accuracy of 74% with shorter Tweets, and both methods showed relatively weaker performance for longer Tweets. This research provides insights into Coronavirus fear sentiment progression, and outlines associated methods, implications, limitations and opportunities.
1. Introduction
The study uses Twitter-based textual analytics to examine COVID-19 public sentiment and compare machine-learning classification methods, motivated by the need for rapid insight into pandemic information flows.
- The study examines public sentiment, Twitter data, descriptive textual analytics, visualization, and AI-based textual classification mechanisms.
- NLP and textual classification methods remain limited in deciphering intrinsic meaning and vulnerable to adversarial text.
- Fear sentiment increased significantly toward the end of March 2020 after Tweets were classified by sentiment.
- Humour and beer associations in early Tweets were overtaken by fear sentiment as COVID-19’s seriousness became evident.
- The research compares Naïve Bayes and Logistic textual classification mechanisms commonly used in artificial intelligence.
- Naïve Bayes achieved 91% accuracy on short Coronavirus Tweets, compared with 74% for logistic regression.
2. Literature Review
The literature review situates textual analytics, Twitter data, sentiment analysis, and machine-learning classification within crisis and social-media research. It focuses on Naïve Bayes and logistic regression as the study’s selected classifiers.
- Textual Analytics: Textual analytics examines textual characteristics, sentiment, visual representations, and endogenous or exogenous features.Endogenous features include tweet length, keywords, special characters, URLs, mentions, and hashtags; exogenous features include source devices and user locations.
- Twitter Analytics: Twitter data has supported crisis analysis, situational awareness, pandemic tracking, and sentiment research.Prior work examined wildfire activity, influenza-like illness, and other crisis-related social-media signals.
- Classification Methods: The review compares several text classifiers while selecting Naïve Bayes and logistic regression for binary Coronavirus Tweet sentiment classification.The selection was based on parsimony and established performance in textual classification.
- Classification Methods: Naïve Bayes uses maximum a posteriori estimation to assign features to the class with the highest conditional probability.The review describes multinomial and Bernoulli Naïve Bayes models as alternative feature representations.
- Classification Methods: Logistic regression models outcome probabilities with a logistic function and commonly uses maximum likelihood estimation to minimize model error.Its training phase includes parameter modeling with optimization techniques and is described as fairly expensive.
3. Methods and Textual Data Analytics
The methods combine exploratory textual analytics, visualizations, sentiment scoring, and machine-learning classification of Coronavirus Tweets. Tweets are analyzed through textual features and then prepared for classification using two selected methods.
- Exploratory Textual Analytics: Exploratory textual analytics summarizes endogenous and exogenous Tweet features and uses visualizations to characterize the Coronavirus Tweet data.The approach fragments and synthesizes textual data through Tweet parts, hashtags, sentiment scores, and character use.
- Sentiment Analysis and Classification: Tweets receive sentiment scores using R and R packages before being split into training and test data for machine-learning classification.The workflow includes positive and negative sentiment categories and evaluates two prominent classification methods.
3.1. Exploratory Textual Analytics
The study applies exploratory textual analytics to Coronavirus Tweets, examining word patterns, sentiment, geography, and source-device associations. These analyses characterize fear sentiment and relationships between tweet content and non-textual variables.
- Data acquisition and preparation: Over nine hundred thousand Coronavirus-focused Tweets were collected from February to March 2020 using Twitter API and the rTweet package in R.The keyword “Corona” was applied without case sensitivity.
- Data acquisition and preparation: Sixty two incomplete, blank, or irrelevant variables were removed, leaving a cleaned dataset with twenty eight variables.
- Word and phrase associations: N-gram analysis identified frequent words, Bigrams, Trigrams, and Quadgrams, while longer sequences lacked sufficient frequency and relevance.The analysis also emphasized that useful n-gram interpretation requires more nuance than simply identifying frequent sequences.
- Sentiment analytics: Fear sentiment increased significantly each day toward the end of March 2020, becoming the dominant emotion across the Tweets data.
- Geo-tagged analytics: Geographic analysis found relatively lower fear levels in states significantly affected by high COVID-19 case counts.
- Association with non-textual variables: Relative source-device ratios showed distinct word and feature associations for iPhone, iPad, and Android users.iPhone users most used “Corona” hashtags and mentions, iPad users most mentioned URLs and “Trump,” and Android users most mentioned “Flu” and “Beer.”
3.2. Machine Learning with Classification Methods
The paper presents Naïve Bayes and Logistic Regression as generative and discriminative classifiers for textual sentiment classification. It frames documents or document features as predictors and sentiment classes as responses.
- Study focus: The study focuses on applying commonly used machine-learning methods to sentiment classification across varying Tweet characteristics, rather than developing new algorithms.
- Model formulation: The classification model represents X as a document or document features and Y as the class being evaluated.
- Compared classifiers: Naïve Bayes is presented as a generative classifier, whereas Logistic Regression is presented as a discriminative classifier.
3.3. Naïve Bayes Classifier
The Naïve Bayes classifier assigns documents to the class with the highest posterior probability, using word features and a conditional-independence assumption. Text preparation and Laplace smoothing support effective classification but remain subject to preprocessing limitations.
- Naïve Bayes estimates the class c with the highest conditional probability for a document d.The classifier uses document features to identify the most probable class.
- The method assumes word positions have no effect and feature probabilities are independent given the class.This assumption enables the joint likelihood to be simplified into a product of individual feature probabilities.
- Document words replace generic features in textual analytics, with word probabilities estimated from class-specific counts and the full vocabulary.The probability estimate uses occurrences of word wi in class c and vocabulary V.
- Laplace add-one smoothing prevents zero likelihoods from forcing an entire class probability to zero.Smoothing is applied because Naïve Bayes multiplies feature likelihoods together.
- Text cleaning must address abbreviations, spelling errors, emoticons, punctuation, and stylistic variation, but may not be completely successful.These issues can affect classification accuracy for both Naïve Bayes and logistic regression.
3.4. Application of Naïve Bayes for Coronavirus Tweet Classification
The study applies Naïve Bayes to binary positive-versus-negative Coronavirus Tweet sentiment across length-based subsets. Accuracy was substantially higher for shorter Tweets than for longer Tweets.
- The experiment assigned positive sentiment to 1 and negative sentiment to 0 for binary classification.Tweet subsets were created according to character-count thresholds.
- 91.43% accuracy was achieved for Tweets shorter than 77 characters using Naïve Bayes.The shorter-Tweet group represented about a quarter of the dataset and used balanced sentiment subsets.
- 57% accuracy was observed when Naïve Bayes classified Tweets shorter than 120 characters.This group contained approximately half of the Tweets and showed lower accuracy than the shorter-Tweet group.
- The analysis used R and associated packages to train on a data subset and test accuracy with about 70 randomized test values.
3.5. Logistic Regression
Logistic regression builds a binary sentiment classifier from feature vectors, a sigmoid-based probability function, a cross-entropy loss, and gradient-descent optimization.
- Logistic regression represents each input as a feature vector and computes an estimated class with a sigmoid classification function.The model uses an objective function and optimizing algorithm as additional components.
- P(y = 1|x) denotes the probability of positive sentiment, while P(y = 0|x) denotes negative sentiment.The classifier outputs one of two sentiment classes.
- The weighted input combines feature values with learned weights and an intercept before sigmoid transformation.wi is the weight of feature xi, and b is the bias term.
- A 0.5 decision boundary converts the estimated probability into the predicted class.
- The Bernoulli-based cross-entropy loss measures disagreement between predicted and actual binary outcomes.The loss is written as −[y log ŷ + (1 − y) log(1 − ŷ)].
- Gradient descent updates weights to minimize the loss function.The gradient reflects the difference between predicted and actual outputs multiplied by the corresponding input.
3.6. Application of Logistic Regression for Coronavirus Tweet Classification
The study compares logistic regression sentiment classification across two Coronavirus Tweet length groups using the same binary labeling framework as the Naïve Bayes experiment.
- Logistic regression classified positive Tweets as 1 and negative Tweets as 0 in a binary sentiment task.
- The section’s stated purpose was to compare Naïve Bayes and logistic regression effectiveness under varying Tweet lengths.
- The experiment used Tweets shorter than 77 characters and Tweets shorter than 125 characters as its two length-based data groups.These groups represented approximately 25% and 50% of the data, respectively.
- R and associated packages were used to train and test the logistic regression models.The results were reported in Table 7.
4. Discussion
The study uses Twitter sentiment and machine-learning classification to generate rapid COVID-19 insights, while acknowledging limits in validation, generalization, platform coverage, and representativeness.
- Validation and extension: The study calls for additional validation, more Coronavirus data, and additional methods to strengthen its classification results.The authors also suggest comparing the NRC lexicon with Bing and Afinn lexicons.
- Scope: The Twitter corpus was filtered by the keyword “Coronavirus,” so the analytical structure may generalize only weakly beyond this pandemic-specific crisis setting.The authors propose alternative dimensionalities and sensitivity analysis to improve validity.
- Data coverage: The authors recommend multiple social-media platforms because Twitter alone does not reflect general mass sentiment across national, state, or local populations.Different platforms provide differing information formats, including short text, blogs, images, and comments.
- Model scope: Classification accuracy decreased as Tweet length increased, while Naïve Bayes and Logistic classification received directional support for short to medium Tweets.The study evaluated viability rather than proposing a formal Tweets sentiment-classification model.
- Ethics: Research using Tweets from vulnerable people in crisis situations raises ethical concerns about obligations to data subjects.The discussion distinguishes researcher obligations to publicly available data subjects from obligations to human subjects.
- Motivation: The analysis identifies rapidly changing COVID-19 psychological risks through automated sentiment analysis of Coronavirus Tweets.The stated application targets health professionals and policymakers seeking rapid insight into population risks.
5. Conclusion and Future Work
The conclusion reports growing COVID-19 fear and negative sentiment, demonstrates exploratory textual analytics and visualization, and compares AI-based Tweet classifiers across Tweet lengths. It presents these methods as a basis for further analytics across communication platforms.
- Conclusion: The study identifies growth in fear sentiment and negative sentiment associated with public concerns about Coronavirus and COVID-19.This is presented as an outcome of addressing public sentiment during the pandemic.
- Conclusion: The researchers demonstrate exploratory and descriptive textual analytics and visualization for discovering early-stage insights from non-text variables.One example is grouping words by levels of a specific non-text variable.
- Conclusion: The study compares artificial-intelligence textual classification mechanisms and demonstrates their usefulness for Tweets of varying lengths.The conclusion frames this comparison as part of the paper’s methodological contribution.
- Future work: The methods offer potential for generating informational and public-sentiment insights relevant to motivational strategies addressing fear-panic-despair associated with Coronavirus.The authors call for extensive analytics and machine-learning solutions across multiple social, news, public, and personal communication platforms.
- Author contributions: All authors contributed to the work across conceptualization, methodology, validation, analysis, writing, visualization, and funding acquisition.The contribution statement assigns software and data curation to J.S. and funding acquisition to G.G.M.N.A.
- Disclosure: The authors declare no conflict of interest.
Abbreviations
The manuscript defines abbreviations used for COVID-19, machine learning, and natural language processing.
- Abbreviations: COVID-19 means Coronavirus Disease 2019.
- Abbreviations: ML means Machine Learning.
- Abbreviations: NLP means Natural Language Processing.