GithubHelp home page GithubHelp logo

lovehacking-cyber / predicting-us-presidential-elections-twitterdata Goto Github PK

View Code? Open in Web Editor NEW
8.0 3.0 4.0 49.03 MB

Predicting US Presidential Elections Using Twitter Data

License: Apache License 2.0

Python 100.00%

predicting-us-presidential-elections-twitterdata's Introduction

Predicting US Presidential Elections Using Twitter Data

Analysis on current US politics and predicting the next US president using Twitter data, Apache Spark using Python, NLTK, Machine Learning

This analysis helps to predict our future president and can be extended to other political elections prediction systems. These trends would focus on the opinion of people and concern towards their future president, which brings out major problems and issues that people have been facing in a country. Big Data and Machine Learning technologies can be used in real time to help in making decisions based on people’s opinion.

Dependencies:

  1. Apache Spark Cluster setup in AWS Use the script file spark-ec2.sh in spark distribution
  2. NLTK sudo pip install -U nltk
  3. Numpy sudo pip install -U numpy

Downloading Twitter Data

You can also download more data with streaming.py, which streams data from the search criteria to standard out. Run like python streaming.py

HOWEVER The downloader requires you to have Twitter API keys to stream the data, as they are private I am not posting in here. Creating new credentials will take no more than 3 mins.

  1. Register your Twitter account with http://dev.twitter.com
  2. Log in to dev.twitter.com and go to "My applications" (hover over your avatar)
  3. Create a new app (gt-big-data, for instance)
  4. Create access tokens in the new app.

Replace tags in streaming.py

access_token = "<access_token>"
access_token_secret = "<access_token_secret>"
consumer_key = "<consumer_key>"
consumer_secret = "<consumer_secret>"

Usage:

  • classifier.py will do sentimental analysis on tweets and classifier tweet based on it's polarity. The classifer was trained with data source(0.8 million tweets) taken from Standford University.

    python classifier.py

  • Data was collected from twitter streaming api

    python streaming.py

predicting-us-presidential-elections-twitterdata's People

Contributors

praveen-kanamarlapudi avatar shabscan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.