Skip to content

This project utilizes sentiment analysis with GPT models to forecast election results by analyzing YouTube video comments.

Notifications You must be signed in to change notification settings

lvcruzh/election_forecasting

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 

Repository files navigation

This repository includes the essential files from the project 'Unveiling the Power of Live Chat Comments in Election Periods: A Comparative Study Using GPT Models'.

About the project:

This research project explores the potential of utilizing social media data to pre- dict election outcomes, with a focus on the context of the 2018 Mexican general election. Through an analysis of YouTube live chat comments during presidential debates streams and employing large language models, the study pursues two primary objectives. Firstly, it aims to evaluate the accuracy of electoral outcome predictions using social media data and GPT models within the Mexican context. Secondly, the project aims to establish a comparative analysis between the forecasts derived from YouTube live chat comments and the predictions generated through conventional public opinion polls that were published during the campaign period. The findings of this study unveil intriguing outcomes: while social media comments demonstrate proficiency in identifying leading candidates, they encounter challenges when it comes to accurately predicting the precise ranking of candidate preferences and approximating vote percentages. This outcome underscores the complexities inherent in achieving representa- tive samples from social media data, highlighting the significance of diversifying data sources in election forecasting with social media data.

Files in this repository:

  • Youtube Comments Retrieval: Utilize 'youtube_comments.ipynb' to effortlessly collect comments from YouTube videos. Tailor this file to your specific video of interest.

  • Sentiment Analysis with GPT Models: Leverage 'gpt.ipynb,' specifically targeting the 'text-davinci-003' model from the OpenAI API to uncover sentiment insights from the video comments.

Prerequisites:

Ensure you have the following packages loaded in python:

  • pytchat
  • pandas
  • openai
  • time

Usage:

  1. Start with 'youtube_comments.ipynb' to retrieve YouTube comments, customizing it for your preferred video.
  2. Perform any necessary preprocessing on the Youtube comments.
  3. Utilize 'gpt.ipynb' with the 'text-davinci-003' model to perform sentiment analysis.

Notes:

  • An OpenAI key is indispensable for API usage.
  • Craft a well-designed prompt for optimal results.

About

This project utilizes sentiment analysis with GPT models to forecast election results by analyzing YouTube video comments.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published