EdisonLeeeee / GreatX

A graph reliability toolbox based on PyTorch and PyTorch Geometric (PyG).
MIT License
83 stars 11 forks source link

Add ratio for `attacker.data()`, `attacker.edge_flips()`, and `attacker.feat_flips()` #5

Closed EdisonLeeeee closed 2 years ago

EdisonLeeeee commented 2 years ago

This PR allows specifying an argument ratio for attacker.edge_flips(), and attacker.feat_flips(), which determines how many generated perturbations were used for further evaluation/visualization. Correspondingly, attacker.data() holds edge_ratio and feat_ratio for these two methods when constructing perturbed graph.

Case1: Only 50% of generated edge perturbations were used

trainer.evaluate(attacker.data(edge_ratio=0.5), mask=...)

Case2: Only 50% of generated feature perturbations were used

trainer.evaluate(attacker.data(feat_ratio=0.5), mask=...)

NOTE: both arguments can be used simultaneously