R: Twitter botsかどうかを判定, tweetbotornot2

Last Updated on July 10, 2021 by shibatau

I.何をする?

 

Rのライブラリtweetbotornot2を用いて、Twitter botかそうでないかを判定します。

followersがbotsかbotsでないかを判定します。

 

Identifying “Dirty” Twitter Bots with R and Python

 

https://github.com/mkearney/tweetbotornot

 

II.試行

 

Iの2番目にあるスクリーンネームのbotである確率を算出します。

リンク上側はボットで、”AOC”以下はボットではないとわかっています。ただし、”realDonaldTrump”は削除されています。

 

## vector of screen names
screen_names <- c(
  "American__Voter", ## (these ones should be bots)
  "MagicRealismBot",
  "netflix_bot",
  "mitchhedbot",
  "rstats4ds",
  "thinkpiecebot",
  "tidyversetweets",
  "newstarsbot",
  "CRANberriesFeed",
  "AOC",             ## (these ones should NOT be bots)
  "realDonaldTrump",
  "NateSilver538",
  "ChadPergram",
  "kumailn",
  "mindykaling",
  "hspter",
  "rdpeng",
  "kearneymw",
  "dfreelon",
  "AmeliaMN",
  "winston_chang"
)

 

次のように適切な判定されています。

 

> predict_bot(screen_names)
[13:28:16] WARNING: amalgamation/../src/learner.cc:851: Loading model from XGBoost < 1.0.0, consider saving it again for improved compatibility
                user_id     screen_name     prob_bot
 1:  829792389925597184 American__Voter 0.9992635846
 2:          3701125272 MagicRealismBot 0.9982991815
 3:          1203840834     netflix_bot 0.8568874002
 4:           214244836     mitchhedbot 0.9962922335
 5: 1075011651366199297       rstats4ds 0.9994236231
 6:          3325527710   thinkpiecebot 0.9983906746
 7:  935569091678691328 tidyversetweets 0.9994184971
 8:  780707721209188352     newstarsbot 0.9997599721
 9:           233585808 CRANberriesFeed 0.9962437153
10:           138203134             AOC 0.0013290618
11:                <NA> realDonaldTrump 0.9754517674
12:            16017475   NateSilver538 0.0012628062
13:            16187637     ChadPergram 0.0036304786
14:            28406270         kumailn 0.0007160160
15:            23544596     mindykaling 0.0005316343
16:            24228154          hspter 0.0007220113
17:             9308212          rdpeng 0.0007580518
18:          2973406683       kearneymw 0.0272120275
19:            93476253        dfreelon 0.0007967994
20:            19520842        AmeliaMN 0.0163756292
21:          1098742782   winston_chang 0.0011890358
                user_id     screen_name     prob_bot

 

 

 

 

 

About shibatau

I was born and grown up in Kyoto. I studied western philosophy at the University and specialized in analytic philosophy, especially Ludwig Wittgenstein at the postgraduate school. I'm interested in new technology, especially machine learning and have been learning R language for two years and began to learn Python last summer. Listening toParamore, Sia, Amazarashi and MIyuki Nakajima. Favorite movies I've recently seen: "FREEHELD". Favorite actors and actresses: Anthony Hopkins, Denzel Washington, Ellen Page, Meryl Streep, Mia Wasikowska and Robert DeNiro. Favorite books: Fyodor Mikhailovich Dostoyevsky, "The Karamazov Brothers", Shinran, "Lamentations of Divergences". Favorite phrase: Salvation by Faith. Twitter: @shibatau

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.