Real-Time Sentiment Analytics and Visualization via ElectionTweetBoard

Analyzing the 2020 presidential election via Twitter Sentiment Analysis

Shantanu Phadke
Towards Data Science

--

This post will explore various forms of and considerations in data analytics, visualization, as well as Machine Learning by delving deeper into a product that I have been developing recently called ElectionTweetBoard (https://www.electiontweetboard.com/).

The “Why” Behind ElectionTweetBoard

Every Data Science or AI-related project needs a powerful driving force behind it. I developed ElectionTweetBoard through a genuine curiosity to find out more about the general public’s opinions about the top candidates in the upcoming presidential election, and how well these opinions correlate with media coverage of the candidates.

As Twitter is a very good source for gathering real-time user-generated data, I decided to craft an automated workflow for pulling in tweets and then analyzing the sentiment of those tweets. From this initial starting point, the product has grown to also include a ‘Quick Links’ section which automatically curates the most relevant articles regarding each of the candidates.

Sentiment Distributions Data Visualization via Candidate Cards

The first major component of the site’s dashboard that sticks out is the individual candidate cards that summarize the current distribution of sentiments that have been picked up from the current set of tweets. The green, blue and red circles represent the percents of positive, neutral and negative respectively.

The central consideration here is to make the colors representing each category of sentiments have clear meanings. Green and red were obvious choices due to their presence in success and error messages as well as common devices like traffic lights. Light blue, on the other hand, is more of a neutral color with its low level of overall saturation. I tried to maintain this color scheme spectrum throughout the app.

Each candidate card also has two buttons linking to two separate pop-up modals. The Tweets Info modal aims to display the results of the on-going tweet sentiment analysis in both qualitative and quantitive terms, while the Quick Links modal picks up the most relevant links for each candidate. Let’s explore these two components in greater depth below:

Tweets Modal

The Tweets Modal consists of three sections, each of which focuses on displaying particular categories of data:

  • Sample Tweets
  • Sentiments Over Time
  • Sentiments By Geography

Qualitative Data Analysis via Sample Tweets

The Sample Tweets tab of the Tweets Modal displays samples of both the latest positive and negative tweets that have been pulled in for each of the candidates. The purpose of this is to allow users a better glimpse into exactly what people are saying about particular candidates at particular points in time.

Time Series Data Visualization via Sentiments Over Time

Now, whereas the Sample Tweets tab focusses on delivering the most relevant, real-time qualitative data, the Sentiments Over Time tab drills down into displaying trends for different categories of sentiment over different periods of time. Such analysis is usually referred to as Time Series analysis.

By combining the aforementioned qualitative data analysis via sample tweets with the time series sentiment analysis from above, one can start to establish a better sense of how certain events/decisions may be correlated with public sentiments.

Geographical Data Visualization via Sentiments by Geography

Sentiments by Geography, the third and last section of the Tweets Modal, focuses on delivering state-based sentiments analysis. Currently, the color-coding is based on the percent of positive or neutral sentiments expressed by tweets from each given state.

Starting Point for Further Exploration

The main point behind ElectionTweetBoard is to increase real-time awareness of the latest developments going on in the election through the lens of public sentiment, however, it also serves as a valuable starting point for further exploration via its Quick Links section.

Quicks Links is a realtime news aggregator that alerts users to the latest and most relevant news articles, videos, and photos based on the general public’s opinions.

Sorting on a Variety of Metrics

ElectionTweetBoard also offers an easy-to-access dropdown to sort candidates by various metrics. Currently, the candidate cards can be sorted based on positive, neutral and negative sentiments, enabling users to pick and choose the particular ordering they want to focus their analysis on. This is also an effective way of providing alternatives to the default, out-of-the-box ordering users see when they first enter the site.

Conclusion

With caucuses primaries starting soon and campaigns heating up, now is a good time as any to check out ElectionTweetBoard @ https://www.electiontweetboard.com/. It should help you stay both up-to-date on the latest happenings and to further analyze these through the data science and machine learning capabilities highlighted above!

Relevant Links

Link to ElectionTweetBoard: https://www.electiontweetboard.com/

--

--

I’m a Software Engineer as well as a Machine Learning and Artificial Intelligence Enthusiast and I mainly write about my explorations into these topics.