<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/botrnot-an-r-app-to-detect-twitter-bots/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="http://blog.revolutionanalytics.com/2018/03/twitter-bot-or-not.html"> Revolutions</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<div>
<p>Twitter's bot problem is <a rel="nofollow" href="https://www.scientificamerican.com/article/how-twitter-bots-help-fuel-political-feuds/" target="_blank">well documented</a>, 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 <a rel="nofollow" href="https://www.nytimes.com/interactive/2018/01/27/technology/social-media-bots.html" target="_blank">feature on bots and follower factories</a>.) </p>
<p>Can we distinguish bots from real users using data science? Journalism professor <a rel="nofollow" href="http://mikewk.com/" target="_blank">Mike Kearney</a> has developed an <a rel="nofollow" href="https://github.com/mkearney/botrnot" target="_blank">R package</a> and <a rel="nofollow" href="https://mikewk.shinyapps.io/botornot/" target="_blank">Shiny web application</a> that analyzes the tweets of a given user to calculate the probability that user is a bot. For example, it correctly detects that @<a rel="nofollow" href="https://twitter.com/TwoHeadlines" target="_blank">TwoHeadlines </a>is a bot:</p>
<p><a rel="nofollow" href="http://a3.typepad.com/6a0105360ba1c6970c01b7c95c61fb970b-pi" target="_blank"><img alt="Botornot" title="Botornot" src="http://a3.typepad.com/6a0105360ba1c6970c01b7c95c61fb970b-450wi"></a></p>
<p>It does fairly well according to my tests, with @<a rel="nofollow" href="https://twitter.com/MagicRealismBot" target="_blank">MagicRealismBot</a> (99.8%), @<a rel="nofollow" href="https://twitter.com/RealPressSecBot" target="_blank">RealPressSecBot</a> (99.8%),  @<a rel="nofollow" href="https://twitter.com/NYT4thDownBot" target="_blank">NYT4thDownBot</a> (99.3%) and @<a rel="nofollow" href="https://twitter.com/threat_update" target="_blank">threat_update</a> (100%) all correctly identified as bots. I'm also pleased to report that my own Twitter account @<a rel="nofollow" href="https://twitter.com/revodavid" target="_blank">revodavid</a> is classified as human (2.6% chance of botness). The app has also been used to <a rel="nofollow" href="http://tomvladeck.com/2018/03/26/our-discourse-is-still-being-poisoned/" target="_blank">identify a potential bot</a> interjecting in the gun control debate. On the other hand, @<a rel="nofollow" href="https://twitter.com/RLangTip" target="_blank">RlangTip</a> is classified as a bot (98.8%), despite my being reliably informed that it's written by humans. </p>
<p>To detect bots, the app applies a gradient boosting machine learning model implemented using the <a rel="nofollow" href="https://mran.microsoft.com/package/gbm" target="_blank">gbm package</a> 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.</p>
<p>Try out the BotOrNot app at the link below, and let us know of any surprises in the results in the comments.</p>
<p>ShinyApps: {<a rel="nofollow" href="https://mikewk.shinyapps.io/botornot/" target="_blank">botrnot</a>}</p>
</div>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="http://blog.revolutionanalytics.com/2018/03/twitter-bot-or-not.html"> Revolutions</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...
<img width="1" alt="" src="http://feeds.feedburner.com/~r/RBloggers/~4/7Umq9bQRbRE" height="1"></a></div>