Coder Social home page Coder Social logo

bot-vs-human's Introduction

Classifying Tweets from Russian Troll Accounts

My project involves building a machine learning model to detect tweets from Russian troll twitter accounts.

If you want to explore some of my tweet-level predictions, check out this tool. You can also use this web app to make predictions on new tweets.

alt text

alt text

Research Process

1. Collect data

For this project, I construct a dataset of about 340,000 labeled tweets, denoting whether they were sent from a Russian troll account or not. The data on Russian troll tweets was compiled by Linvill and Warren of Clemson University, and open-sourced through FiveThirtyEight. In order to construct a control group, I employed the twint package to collect a sample of tweets from verified users, tweeting within the same time period as the Russian troll accounts. This collection can be replicated using this code:

$ bash collect_verified_tweets.sh

2. Process text data and feature engineering

I perform extensive preprocessing of the raw text from tweets (including tokenization, stop word removal, and lemmatization), as well as feature engineering. You can find these functions in src:

3. Build models and tune hyperparameters

I test out several different classifiers, and settle on random forest as the best estimator. The model evaluation metric I'm trying to optimize for is recall (which will minimize false negatives). Here's a summary comparing the performance of various baseline models I tested:

alt text

You can take a look at my entire workflow in a single notebook, which lives here.

4. Results

After hyperparameter tuning through grid search, my random forest classifier achieves a recall score of 93.3%.

You can explore tweet predictions using this tool.

You can try making predictions on new tweets using this web app. (The source code for this web app is available here.)

A slide deck summarizing my project can be found here.

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.