{"id":29884082,"url":"https://github.com/shivchander/political-alignment-prediction","last_synced_at":"2026-05-09T03:39:28.253Z","repository":{"id":37225637,"uuid":"243391597","full_name":"shivchander/political-alignment-prediction","owner":"shivchander","description":"University of Cincinnati - Senior Research Project 2020","archived":false,"fork":false,"pushed_at":"2022-11-21T22:48:12.000Z","size":16135,"stargazers_count":1,"open_issues_count":5,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-31T16:31:04.955Z","etag":null,"topics":["deep-learning","lstm","nlp","political-science","python","sentiment-analysis","tensorflow","twitter-users"],"latest_commit_sha":null,"homepage":"","language":"Jupyter Notebook","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/shivchander.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-02-26T23:59:45.000Z","updated_at":"2021-08-12T03:43:09.000Z","dependencies_parsed_at":"2023-01-20T20:02:53.392Z","dependency_job_id":null,"html_url":"https://github.com/shivchander/political-alignment-prediction","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/shivchander/political-alignment-prediction","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivchander%2Fpolitical-alignment-prediction","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivchander%2Fpolitical-alignment-prediction/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivchander%2Fpolitical-alignment-prediction/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivchander%2Fpolitical-alignment-prediction/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shivchander","download_url":"https://codeload.github.com/shivchander/political-alignment-prediction/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shivchander%2Fpolitical-alignment-prediction/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32806536,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-08T08:22:46.396Z","status":"online","status_checked_at":"2026-05-09T02:00:06.633Z","response_time":123,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","lstm","nlp","political-science","python","sentiment-analysis","tensorflow","twitter-users"],"created_at":"2025-07-31T14:25:25.462Z","updated_at":"2026-05-09T03:39:28.248Z","avatar_url":"https://github.com/shivchander.png","language":"Jupyter Notebook","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Deep Pollster: Political Orientation Prediction\n\n\u003e University of Cincinnati Senior Design 2020\n\n\u003e Deep Pollster is an data analysis application that uses Deep Learning to predict the political leaning of Twitter users in a particular geographical region of the USA\n\nTable of contents\n=================\n\n\u003c!--ts--\u003e\n   * [Project Description](#project-description)\n        * [Abstract](#abstract)\n        * [Team Members](#team-members)\n        * [Project Advisor](#faculty-advisor)\n        * [Challenges](#challenges)\n        * [Solution](#solution)\n   * [Architecture](#architecture)\n        * [Modules](#modules)\n            * [Data Extraction](#data-extraction-module)\n                * [Dataset](#dataset)\n            * [Model](#model)\n                * [Classification Model](#classification-model)\n                * [Ensemble Classifier](#ensemble-classifier)\n            * [Networking](#networking-module)\n        * [Technologies](#technologies)\n   * [Testing \u0026 Results](#testing--results)\n        * [Test Plan](#test-planassignmentsassignment-1testplanmd)\n        * [Test Case](#test-case)\n        * [Results](#results)\n            * [Result 1](#result-1)\n            * [Result 2](#result-2)\n        * [Inference](#inference)\n   * [Future Work](#future-work)\n   * [User Manual](#user-manual)\n   * [Video](#videohttpswwwyoutubecomwatchvcv4k47oorfafeatureyoutube)\n   * [Presentation](#presentationassignmentsassignment-3deeppollster_presentationpdf)\n   * [Poster](#poster)\n   * [Assessments](#assessments)\n        * [Initial Self-Assessment](#initial-self-assessment)\n        * [Final Self-Assessment](#final-self-assessment)\n   * [Summary of Hours](#summary-of-hours)\n   * [Assignments](assignments)\n   * [Appendix](#license)\n\u003c!--te--\u003e\n\nProject Description\n===================\n\n## Abstract\n\nSocial Networking has risen to a place of prominence as a medium of publishing information. Times are constantly changing, and the power to sway and portray political opinions is shifting from traditional media such as newspapers and television networks to social media platforms like twitter. This has given rise to new directions of research in Computational Political Science.\n\nIn this venture we reexamine the problem of measuring and predicting the political orientation of twitter users. We expect to contribute to the study of the political blogosphere by incorporating multiple hypotheses about the behavior of the average twitter user and a registered politician, alike. Incorporating ideas such as tweets, retweets, subtweeting, followers and followees network and degrees of separation helps us understand the twitter political scenario better and helps us better understand how to leverage these sources of information. In recent times, hundreds of researchers take to twitter to analyze the effect of twitter on major political events such as the 2016 and 2020 U.S. elections, and we think that our technical contribution would be the reimagination of the traditional problem of predicting the political leaning of a given user. \n\nBy studying the political orientation of twitter users, it is possible to target advertisements at individuals, shape digital profiles, and deliver news, articles, views and products that are individualistic and personalized. This could also be used to predict the political outcome of an election by predicting the leaning of users in a geographical location.\n\n\u003e Index Terms - Twitter, Political Science, NLP, Deep Learning, Neural Networks\n\n## Challenges\nSentiment analysis on tweets to assess political leaning has its disadvantages :\n\n* Does not paint a complete and holistic picture of the users' ideological views\n* Cannot build a digital profile of a user from a single or even with a temporal series of tweets   \n* Assessing political leaning of a demography does not serve the purposes and intents of individual orientation   \n\n## Solution\nWe leverage more than just tweet-retweet maximization, or a network matrix :     \n\n* Binary classification of the latest tweets, retweets and liked tweets on the basis of political leaning\n* Identifying the degree of separation between the user and politicians from both the political sides \n\nOur proposed system is curated to provide a more rounded and holistic sense of the individual user, painting an overall picture of their digital profile, leading to potential in marketing and business spheres.   \n\n\n## Team Members\n\n   Shivchander Sudalairaj - sudalasr@mail.uc.edu\n   \n   Sagar Panwar - panwarsr@mail.uc.edu\n  \n## Faculty Advisor\n\nAnca Ralescu - ralescal@ucmail.uc.edu\n\n\nArchitecture\n============\n\n![arch](assets/architecture.png)\n\n## Modules\n\n### Data Extraction Module\n\n![dataextraction](assets/data_ext.png)\n\n### Dataset\n\u003e [Link to download the dataset](https://www.kaggle.com/kapastor/democratvsrepublicantweets)\n\n### Model\n\n#### Classification Model\n![classificationmodel](assets/model.png)\n\n#### Ensemble Classifier\n![ensemble](assets/ensemble.png)\n\n### Networking Module\n\u003e Degree of Seperation (Erdos Number)\n![networking](assets/network_module.png)\n\n## Technologies\n\n* [Twitter API](https://developer.twitter.com/en/docs)\n* [Keras](https://keras.io)\n* [Tensorflow](https://www.tensorflow.org)\n* [Pandas](https://pandas.pydata.org)\n\nTesting \u0026 Results\n=================\n## [Test Plan](assignments/assignment-1/testplan.md)\n\n## Test Case\n* The model was tested with multiple sets of test cases to eliminate any innate bias\n* Each sets of test cases consists of a set of 50 previously untested politicians’ twitter handles\n\n_Hypothesis : Politicians are relatively consistent with the language models that they follow while publishing tweets on twitter_\n\n## Results\n\n### Result 1\n![result1](assets/missclassifications.png)\n\n\u003eAfter running our tests, we observed that our model was able to predict democratic politicians with 100% accuracy\nWhile the misclassifications arose with republican politicians resulting with an accuracy of 80%\n\n\n### Result 2\n![result2](assets/ConfidenceLevels.png)\n\n\u003eAfter running our tests, we observed that our model was able to identify democrats with significantly higher confidence than republicans.\n\n\u003eWe also observed that predictions from tweets model was more stable than retweets and liked tweets. This supports our initial hypothesis for variable weights\n\n## Inference\n\n* Democratic tweets consistently fall on the political left\n* Republican tweets falls more on political centre and centre-right\n* Democrats are more consistent with their language and in turn political ideologies used on twitter\n* Republicans use language which is more ambiguous and tend to waver between left and right of the political spectrum\n* Naively extrapolating this model to general public users will cause inherent bias \n\nFuture Work\n===========\n* The handling of tweet content analysis and classification can further be improved to handle spam accounts. It is also to be noted that sarcasm is yet to be handled by our model and additions could be made to account for this\n* To develop a generalized model to be applicable for general public users, we would need to survey users and find out their political orientation to develop a more general dataset and retrain the model using the dataset\n\n\n[User Manual](usermanual.md)\n========================================\n\n[Video](https://www.youtube.com/watch?v=cv4K47OorfA\u0026feature=youtu.be)\n===================================================================\n\n[Presentation](assignments/assignment-3/DeepPollster_Presentation.pdf)\n======================================================================\n\nPoster\n======\n\u003e ![Link to pdf](assignments/assignment-5/Research-2.pdf)\n\n\n![poster|50%](assets/Research.png)\n\nAssessments\n===========\n\n## Initial Self-Assessment\n\n* [Shivchander Sudalairaj](assesments/shiv_fall_assessment.md)\n* [Sagar Panwar](assesments/sagar_fall_assessment)\n\n## Final Self-Assessment\n\n* [Shivchander Sudalairaj](assesments/shiv_final_assessment.md)\n* [Sagar Panwar]()\n\nSummary of Hours\n================\n\n|    |     Date    | Category                       | Shiv | Sagar |\n|----|:-----------:|--------------------------------|:----:|:-----:|\n| 1  | 1/20 - 1/25 | Twitter API                    |  4   |  10   |\n| 2  |  1/26 - 2/1 | Data Exploration               |   5  |   10  |\n| 3  |  2/2 - 2/15 | Research Exploration           |   5  |   10  |\n| 4  | 2/16 - 2/22 | Experiments with LSTM          |   5  |   3   |\n| 5  | 2/23 - 2/29 | Data Preprocessing             |   5  |   2   |\n| 6  | 3/1 - 3/7   | Model Architecture Experiments | 10   |   5   |\n| 7  | 3/8 - 3/14  | Model Training                 |  6   |   2   |\n| 8  | 3/15 - 3/21 | Model Testing                  |  4   |   2   |\n| 9  | 3/22 - 4/4  | Integration                    |  7   |   2   |\n| 10 | 4/5 - 4/11  | Documentation and Github       |  4   |   4   |\n|    |             | Total Hours                    | 55   | 50    |\n\n\n[Assignments](assignments)\n==========================\n\nLicense\n=======\n\n[![License](http://img.shields.io/:license-mit-blue.svg?style=flat-square)](http://badges.mit-license.org)\n\n- **[MIT license](LICENSE)**\n- Copyright 2020\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivchander%2Fpolitical-alignment-prediction","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshivchander%2Fpolitical-alignment-prediction","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshivchander%2Fpolitical-alignment-prediction/lists"}