Coder Social home page Coder Social logo

graph-universal-attack's Introduction

Graph Universal Adversarial Attack (GUA)

Usage

  • PyTorch 0.4 or 0.5
  • Python 2.7 or 3.6
  • networkx, scipy, sklearn, numpy, pickle

Train the attack model

Example: python generate_perturbation.py --dataset cora --radius 4

dataset: the network dataset you are going to attack
radius: the radius of the l2 Norm Projection

The verision of jupyter notebook is also supported as: universal_attack.ipynb

Evaluate the test ASR

After finishing the training of the GUA, we then evaluate the test asr over the test nodes

Example: python eval_baseline.py --dataset cora --radius 4 --evaluate_mode universal

dataset: the network dataset you are going to attack
radius: the radius of the l2 Norm Projection evaluate_mode has five values:

  • "universal": graph universal attack
  • "limitted_attack": random attack, a prescribed number of anchor nodes are randomly sampled
  • "global_random": global random attack
  • "victim_attack": victim attack
  • "universal_delete": randomly delete a part of nodes from the trained anchor nodes, to find the trade-off
  • "advanced_victim_attack": a prescribed number of anchor nodes are composed of the nodes with the highest confidence from the victim class
  • "advanced_limitted_attack": advanced random attack, a prescribed number of anchor nodes are randomly sampled from the top 10% nodes with the highest degrees

The perturbation results trained by GUA when radius = 4, for each dataset: Cora, Citeseer and Pol.Blogs are also provided in "GUA/perturbation_results", which can be used directly for testing

The verision of jupyter notebook is also supported as: evaluate.ipynb

You can also validate the transferability on other embedding methods:
Node2vec: python node2vec/evaluate_n2v --dataset cora
DeepWalk: python deepwalk/evaluate_deepwalk --dataset cora
pyGAT: python pyGAT/evaluate_GAT --dataset cora

graph-universal-attack's People

Contributors

chisam0217 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.