Computer Science Students Predict Biden’s Win
November 11, 2020
The Advanced Computer Science class predicted that former-Vice President Joe Biden would win the presidential election based on analyzing the language used in tweets about the candidates.
Drawing on public access that Twitter provides to computer program developers, students applied “sentiment analysis” to roughly one million tweets posted during the month of October.
The project taught the students important coding skills and also showed how they can be applied in life.
“It inspired me to think about what other things are possible with the use of coding and the different ways we can intertwine it with other very important aspects of our society,” wrote junior Lizette Hernandez in an email.
Sentiment analysis is an active area in computer programming, in which computers interpret natural language by assigning a score to words that are common in English. The students used a dictionary of about 2500 words, such as “great”, “horrible”, “fraud” and “amazing”. The words were each given a score between -5 and +5, then the scores for all the words in the tweets on a given day were totaled to find out a composite score for that day.
“Based on this, we were able to figure out whether the posts were positive or negative,” explained Lizette and sophomore Angie Perez Salvador in a paragraph explaining the graphs they created and contributed to The Eastside Panther. “We were able to determine which candidate was being talked about more positively … The graph shows that Biden, more times than not, had an overall more positive trend than Trump.”
As a result, the students predicted that Biden would win the 2020 presidential election.
The first graph shows sentiment scores, which appear to show that President Trump received no positive tweets. However, that is due to the way the data was analyzed. By contrast, in the second graph, which shows the percentage of positive tweets out of the total each day, it becomes clear that President Trump received 30 – 35% positive tweets while Biden received 35 – 40% positive tweets.
In the first graph, Biden’s positivity shifts abruptly to the negative zone between Oct. 14 and Oct. 23, a result that raised questions.
“Reviewing the news stories around that time, and studying a sampling of the tweets themselves, the conclusion that I eventually reached is that the dip may have been triggered by the New York Post story on Oct. 14 about “Hunter Biden’s laptop”, wrote Computer Science teacher Anil Vempati. “The story didn’t gain much traction in mainstream media, but it seems to have caught social media’s attention!”
The experience of learning computer programming methods by using authentic data from an ongoing world event made the project especially interesting.
“From my end, it was definitely very eye-opening to how much media in general can tell us a lot about not just the present and how people feel, but also the future and what can happen,” Lizette wrote. “It was very exciting to see our prediction coming true in front of my eyes and it gave me hope that our lives could be changing for the better.”