Skip to content

Commit

Permalink
add comments on fixing seed for random attack
Browse files Browse the repository at this point in the history
  • Loading branch information
ChandlerBang committed Oct 8, 2020
1 parent f780889 commit 64f4a34
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions train.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@

if args.attack == 'random':
from deeprobust.graph.global_attack import Random
# to fix the seed of generated random attack, you need to fix both np.random and random
# you can uncomment the following code
# import random; random.seed(args.seed)
# np.random.seed(args.seed)
attacker = Random()
n_perturbations = int(args.ptb_rate * (adj.sum()//2))
attacker.attack(adj, n_perturbations, type='add')
Expand Down

0 comments on commit 64f4a34

Please sign in to comment.