With the 2020 election going on, it is more important than ever to understand a politician’s affiliation. Today, I will teach you how to build a machine learning model that predicts a political party affiliation based on their tweets.
To gather the data/tweets, we will be using the Twitter API. The Twitter handles for all senators are here: (https://www.sbh4all.org/wp-content/uploads/2019/04/116th-Congress-Twitter-Handles.pdf)
I also generated a list of leaders in both parties that we will be using to train our model.
Democrats: Joe Biden (Presidential Nominee), Kamala Harris (VP Nominee), Bernie Sanders, Elizabeth Warren
Republicans: Donald Trump (President), Mike Pence (Vice President), Mitch McConnell, Ted Cruz
To gather useful features, we must transform the tweets into vectors of some sort. In the diagram below, I will show the 3 main features we will be using in this model and how to get them.
#politics #machine-learning #nlp #data-science