"Adversarial Socialbots Modeling Based on Structural Information Principles."
- Python version
3.8 - Check
req.txtfile for details. Basically, we will needtorch,ray[rllib],tensorflow,networkx, and other basic packages. All other libraries and their version are stored inreq.txtfile. Or you can install all of the libraries by running:
conda create --name <env> --file req.txt
- Install the
gym_botenvironment:
cd gym_bot
python -m pip install -e .
- The main
gymenvironment file is at./gym-bot/gym_bot/envs/advbot_env_single_detect_large_hiar.py.
- All the collected 100 news propagation networks are stored in
./database/_hoaxy#.pklwith#ranges from 0-99. These arenetworkxpython object for convenient loading withnetworkxlibrary. - The test script (below) will automatically load the
trainandtestportion of the dataset.
- We also provide the
blackboxbot detector trained on the configurations specified in the paper at./detector/RandomForestClassifier_TRAM_lengthNone.joblib. This is a scikit-learnRandom Forest Classifierobject that can be loaded usingpicklelibrary. - Please refer to
./gym-bot/gym_bot/envs/advbot_env_single_detect_large_hiar.pyto how to load and use this bot detector.
Check the ppo_single_large_hiar.py.
config = {
"NAME":'advbot-v6',
"run_name":None,
"seed":SEED,
"probs":0.8, #set -1 to random
"graph_algorithm":"node2vec",
"WALK_P":1, # parameter p of node2vec
"WALK_Q":50, # parameter q of node2vec
"model_type":"CONV",
"node_embed_dim":42, # node embedding dimension of node2vec
"num_filters":8, # number of filters for CONV
"validation_graphs":[],
"reward_shaping":None,
"num_workers":5, # number of workers used during train/test
"num_gpus":1, # number of GPUS
"graph_feature":"gcn", # gcn means node2vec features
"lr":0.0003, # learning rate
"entropy_coeff":0.01, # ppo parameter
"training_iteration":10000, # number of training iterations
"checkpoint_freq":5, # frequency of saving checkpoints during training
"wandb_key":"" #wandb API (replace with your own),
"sip": True
}
config_test = {
"custom_max_step": 120, # we train on 60 timesteps be default but during test we test on longer 120
"detection_interval":20, # interval K refered in the paper
"greedy": False, # whether test the AgentI+H in the paper (heuristic method)
}
RUN: python ppo_single_large_hiar.py train
- To reproduce the reuslts, run:
python ppo_single_large_hiar.py test ./checkpoint_best/checkpointforSIASMandpython ppo_single_large_hiar.py greedy ./checkpoint_best/checkpointforSIASM-Hbaseline.