GCN_Spectral_Attack

Requirement

  • python >= 3.6
  • pytorch >= 1.2.0

For example: python: 3.7, pytorch: 1.5.0+cu101

Exucution Command

You can train and save a clean model; attack a loaded model in both training time (poisoning attack) and test time (evasion attack). The following commands are run under the root folder.

Train a Natural Model

python -m nat_train --dataset cora --gcn_epochs 200 --lr 0.01 --model_dir ./nat_model_saved/

Attack a Trained Model

  • evasion attack: python -m attack --dataset cora --ptb_rate 0.05 --reg_weight 0.0 --model PGD --target_node test --model_path ./nat_model_saved/cora_gcn.pt

  • poisoning attack: python -m attack --dataset cora --ptb_rate 0.05 --reg_weight 0.0 --model min-max --target_node train --model_path ./nat_model_saved/cora_gcn.pt

Train a Robust Model Adversarially

python -m adv_train --dataset cora --adv_epochs 200 --lr 0.0005 --ptb_rate 0.05 --reg_weight 0.0 --model_dir ./rob_model_saved/