BotRNot: An R app to detect Twitter bots

March 29, 2018
By

(This article was first published on Revolutions, and kindly contributed to R-bloggers)

Twitter's bot problem is well documented, influencing discourse on divisive topics like politics and civil rights. But it's getting harder and harder to spot such nefarious bots, who often borrow biographies and tweets from real (and often stolen) profiles to evade detection. (The New York Times recently published an outstanding feature on bots and follower factories.) 

Can we distinguish bots from real users using data science? Journalism professor Mike Kearney has developed an R package and Shiny web application that analyzes the tweets of a given user to calculate the probability that user is a bot. For example, it correctly detects that @TwoHeadlines is a bot:

Botornot

It does fairly well according to my tests, with @MagicRealismBot (99.8%), @RealPressSecBot (99.8%),  @NYT4thDownBot (99.3%) and @threat_update (100%) all correctly identified as bots. I'm also pleased to report that my own Twitter account @revodavid is classified as human (2.6% chance of botness). The app has also been used to identify a potential bot interjecting in the gun control debate. On the other hand, @RlangTip is classified as a bot (98.8%), despite my being reliably informed that it's written by humans. 

To detect bots, the app applies a gradient boosting machine learning model implemented using the gbm package in R. Factors used to identify bot-like behavior include the user's number of followers and followed accounts, the bio, and use of hashtags, @-mentions, and capital letters in account's last 100 tweets.

Try out the BotOrNot app at the link below, and let us know of any surprises in the results in the comments.

ShinyApps: {botrnot}

To leave a comment for the author, please follow the link and comment on their blog: Revolutions.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)