Code Monkey home page Code Monkey logo

g2a2c's Introduction

Source Code for AAAI'23 paper: Let Graph be the Go Board: Gradient-free Node Injection Attack for Graph Neural Networks via Reinforcement Learning

G2A2C

Instruction

Hi all, this is the official repository for AAAI 2023 paper: Let Graph be the Go Board: Gradient-free Node Injection Attack for Graph Neural Networks via Reinforcement Learning. Our paper can be found at [arXiv link]. We sincerely apprecaite your interests in our projects!

To reproduce our experiments on Cora, Citeseer, Pubmed, Am. Photo, Am. Comp., Wiki. CS., please simple run the following code

python actor_critic --dataset ${dataset}

The default setting for this script is single target injection attack, where, to attack one target node, only one node, one edge and zero feature distribution shift are allowed.

However you can easily extend our attack scheme into any budget combination, by specifying --node_budget, --edge_budget, and --feature_budget.

To change the architecture of the victim model, please specify --victim_model with gcn, sgc, gat, appnp.

To reproduce our experiments on OGB-Prod. and Reddit, please first download the pre-processed dataset from the official repo of G-NIA from this link, and restructure the working directory as the following:

G2A2C
|   README.md
|   actor_critic.py
|   attack_utils.py
|   model.py
|
|----datasets
|    |   files downloaded from G_NIA
|       

Dependencies

The main libraries we utilize are:

  • torch===1.11.0
  • dgl==0.9.0
  • pyro-ppl==1.8.1

Cite

If you find this repository useful in your research, please cite our paper:

@inproceedings{ju2022let,
  title={Let Graph be the Go Board: Gradient-free Node Injection Attack for Graph Neural Networks via Reinforcement Learning},
  author={Ju, Mingxuan and Fan, Yujie and Zhang, Chuxu and Ye, Yanfang},
  booktitle={Thirty-Seventh AAAI Conference on Artificial Intelligence},
  year={2023}
}

Credit

Some dataloading scripts come from the official repository of G-NIA link.

Contact

Mingxuan Ju ([email protected])

g2a2c's People

Contributors

jumxglhf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

aliya6

g2a2c's Issues

why the variable best_solution's edges is always a self-loop, is there anything i wrong

{2319: {'node_feat': tensor([[0., 0., 0., ..., 0., 0., 0.]]), 'edges': [[2319, 2319]]}, 2208: {'node_feat': tensor([[0.0384, 0.0384, 0.0384, ..., 0.0000, 0.0384, 0.0000]]), 'edges': [[2208, 2208]]}, 2396: {'node_feat': tensor([[0.0372, 0.0372, 0.0000, ..., 0.0372, 0.0000, 0.0000]]), 'edges': [[2396, 2396]]}, 2449: {'node_feat': tensor([[0.0000, 0.0365, 0.0365, ..., 0.0000, 0.0365, 0.0000]]), 'edges': [[2449, 2449]]}, 1767: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0369, 0.0369, 0.0000]]), 'edges': [[1767, 1767]]}, 2018: {'node_feat': tensor([[0.0376, 0.0000, 0.0376, ..., 0.0376, 0.0376, 0.0376]]), 'edges': [[2018, 2018]]}, 2416: {'node_feat': tensor([[0.0377, 0.0000, 0.0000, ..., 0.0377, 0.0000, 0.0000]]), 'edges': [[2416, 2416]]}, 2418: {'node_feat': tensor([[0.0380, 0.0380, 0.0380, ..., 0.0000, 0.0380, 0.0380]]), 'edges': [[2418, 2418]]}, 2257: {'node_feat': tensor([[0.0000, 0.0381, 0.0381, ..., 0.0000, 0.0381, 0.0381]]), 'edges': [[2257, 2257]]}, 1915: {'node_feat': tensor([[0.0000, 0.0000, 0.0368, ..., 0.0368, 0.0000, 0.0000]]), 'edges': [[1915, 1915]]}, 2088: {'node_feat': tensor([[0.0000, 0.0370, 0.0000, ..., 0.0000, 0.0000, 0.0370]]), 'edges': [[2088, 2088]]}, 2660: {'node_feat': tensor([[0.0378, 0.0000, 0.0378, ..., 0.0378, 0.0000, 0.0378]]), 'edges': [[2660, 2660]]}, 2137: {'node_feat': tensor([[0.0379, 0.0379, 0.0000, ..., 0.0379, 0.0000, 0.0000]]), 'edges': [[2137, 2137]]}, 2022: {'node_feat': tensor([[0.0373, 0.0000, 0.0373, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2022, 2022]]}, 2563: {'node_feat': tensor([[0.0000, 0.0378, 0.0000, ..., 0.0000, 0.0000, 0.0378]]), 'edges': [[2563, 2563]]}, 2110: {'node_feat': tensor([[0.0372, 0.0000, 0.0000, ..., 0.0372, 0.0000, 0.0000]]), 'edges': [[2110, 2110]]}, 1991: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0369, 0.0369, 0.0000]]), 'edges': [[1991, 1991]]}, 2510: {'node_feat': tensor([[0.0371, 0.0000, 0.0000, ..., 0.0000, 0.0371, 0.0000]]), 'edges': [[2510, 2510]]}, 2431: {'node_feat': tensor([[0.0390, 0.0000, 0.0390, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2431, 2431]]}, 2099: {'node_feat': tensor([[0.0373, 0.0373, 0.0000, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2099, 2099]]}, 2306: {'node_feat': tensor([[0.0372, 0.0000, 0.0000, ..., 0.0372, 0.0000, 0.0000]]), 'edges': [[2306, 2306]]}, 2702: {'node_feat': tensor([[0.0000, 0.0380, 0.0380, ..., 0.0000, 0.0000, 0.0380]]), 'edges': [[2702, 2702]]}, 2193: {'node_feat': tensor([[0.0000, 0.0365, 0.0365, ..., 0.0000, 0.0365, 0.0365]]), 'edges': [[2193, 2193]]}, 2562: {'node_feat': tensor([[0.0000, 0.0373, 0.0373, ..., 0.0000, 0.0373, 0.0000]]), 'edges': [[2562, 2562]]}, 2281: {'node_feat': tensor([[0.0000, 0.0368, 0.0000, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2281, 2281]]}, 1783: {'node_feat': tensor([[0.0372, 0.0372, 0.0000, ..., 0.0372, 0.0000, 0.0000]]), 'edges': [[1783, 1783]]}, 2354: {'node_feat': tensor([[0.0368, 0.0368, 0.0368, ..., 0.0368, 0.0000, 0.0368]]), 'edges': [[2354, 2354]]}, 2136: {'node_feat': tensor([[0.0000, 0.0370, 0.0000, ..., 0.0000, 0.0370, 0.0000]]), 'edges': [[2136, 2136]]}, 2194: {'node_feat': tensor([[0.0366, 0.0000, 0.0000, ..., 0.0366, 0.0366, 0.0366]]), 'edges': [[2194, 2194]]}, 2165: {'node_feat': tensor([[0.0363, 0.0363, 0.0363, ..., 0.0363, 0.0000, 0.0000]]), 'edges': [[2165, 2165]]}, 1713: {'node_feat': tensor([[0.0377, 0.0000, 0.0377, ..., 0.0377, 0.0377, 0.0000]]), 'edges': [[1713, 1713]]}, 2429: {'node_feat': tensor([[0.0367, 0.0367, 0.0000, ..., 0.0000, 0.0367, 0.0367]]), 'edges': [[2429, 2429]]}, 2666: {'node_feat': tensor([[0.0000, 0.0000, 0.0366, ..., 0.0366, 0.0000, 0.0366]]), 'edges': [[2666, 2666]]}, 2030: {'node_feat': tensor([[0.0372, 0.0372, 0.0000, ..., 0.0372, 0.0372, 0.0000]]), 'edges': [[2030, 2030]]}, 2167: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0379, 0.0379]]), 'edges': [[2167, 2167]]}, 2195: {'node_feat': tensor([[0.0000, 0.0000, 0.0364, ..., 0.0364, 0.0000, 0.0000]]), 'edges': [[2195, 2195]]}, 2458: {'node_feat': tensor([[0.0000, 0.0377, 0.0000, ..., 0.0377, 0.0000, 0.0000]]), 'edges': [[2458, 2458]]}, 2502: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0366]]), 'edges': [[2502, 2502]]}, 2070: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0377, 0.0000, 0.0000]]), 'edges': [[2070, 2070]]}, 1912: {'node_feat': tensor([[0.0367, 0.0000, 0.0000, ..., 0.0367, 0.0367, 0.0367]]), 'edges': [[1912, 1912]]}, 2300: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0379]]), 'edges': [[2300, 2300]]}, 1918: {'node_feat': tensor([[0.0368, 0.0368, 0.0000, ..., 0.0368, 0.0000, 0.0000]]), 'edges': [[1918, 1918]]}, 2342: {'node_feat': tensor([[0.0000, 0.0373, 0.0000, ..., 0.0000, 0.0000, 0.0373]]), 'edges': [[2342, 2342]]}, 2622: {'node_feat': tensor([[0.0000, 0.0371, 0.0000, ..., 0.0371, 0.0371, 0.0000]]), 'edges': [[2622, 2622]]}, 2025: {'node_feat': tensor([[0.0370, 0.0370, 0.0000, ..., 0.0370, 0.0370, 0.0370]]), 'edges': [[2025, 2025]]}, 1791: {'node_feat': tensor([[0.0362, 0.0000, 0.0362, ..., 0.0362, 0.0000, 0.0000]]), 'edges': [[1791, 1791]]}, 1930: {'node_feat': tensor([[0.0384, 0.0384, 0.0384, ..., 0.0384, 0.0384, 0.0000]]), 'edges': [[1930, 1930]]}, 2586: {'node_feat': tensor([[0.0000, 0.0000, 0.0373, ..., 0.0373, 0.0000, 0.0373]]), 'edges': [[2586, 2586]]}, 1768: {'node_feat': tensor([[0., 0., 0., ..., 0., 0., 0.]]), 'edges': [[1768, 1768]]}, 2273: {'node_feat': tensor([[0.0000, 0.0000, 0.0371, ..., 0.0000, 0.0371, 0.0371]]), 'edges': [[2273, 2273]]}, 2069: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0370, 0.0370, 0.0370]]), 'edges': [[2069, 2069]]}, 2683: {'node_feat': tensor([[0.0000, 0.0383, 0.0383, ..., 0.0383, 0.0000, 0.0383]]), 'edges': [[2683, 2683]]}, 1907: {'node_feat': tensor([[0.0362, 0.0362, 0.0362, ..., 0.0000, 0.0362, 0.0362]]), 'edges': [[1907, 1907]]}, 2644: {'node_feat': tensor([[0.0375, 0.0375, 0.0000, ..., 0.0375, 0.0000, 0.0000]]), 'edges': [[2644, 2644]]}, 2211: {'node_feat': tensor([[0.0381, 0.0381, 0.0000, ..., 0.0000, 0.0381, 0.0381]]), 'edges': [[2211, 2211]]}, 2290: {'node_feat': tensor([[0.0383, 0.0383, 0.0383, ..., 0.0000, 0.0383, 0.0000]]), 'edges': [[2290, 2290]]}, 2478: {'node_feat': tensor([[0.0000, 0.0000, 0.0384, ..., 0.0384, 0.0000, 0.0000]]), 'edges': [[2478, 2478]]}, 2234: {'node_feat': tensor([[0.0373, 0.0000, 0.0373, ..., 0.0373, 0.0000, 0.0373]]), 'edges': [[2234, 2234]]}, 2532: {'node_feat': tensor([[0.0000, 0.0365, 0.0000, ..., 0.0365, 0.0365, 0.0000]]), 'edges': [[2532, 2532]]}, 2404: {'node_feat': tensor([[0.0371, 0.0000, 0.0000, ..., 0.0371, 0.0000, 0.0000]]), 'edges': [[2404, 2404]]}, 2231: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0380, 0.0000, 0.0380]]), 'edges': [[2231, 2231]]}, 2318: {'node_feat': tensor([[0.0000, 0.0000, 0.0372, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2318, 2318]]}, 2192: {'node_feat': tensor([[0.0000, 0.0000, 0.0362, ..., 0.0362, 0.0000, 0.0362]]), 'edges': [[2192, 2192]]}, 2511: {'node_feat': tensor([[0.0367, 0.0000, 0.0000, ..., 0.0367, 0.0367, 0.0000]]), 'edges': [[2511, 2511]]}, 1968: {'node_feat': tensor([[0.0000, 0.0356, 0.0000, ..., 0.0356, 0.0000, 0.0356]]), 'edges': [[1968, 1968]]}, 2189: {'node_feat': tensor([[0.0369, 0.0369, 0.0000, ..., 0.0000, 0.0369, 0.0369]]), 'edges': [[2189, 2189]]}, 2161: {'node_feat': tensor([[0.0375, 0.0375, 0.0375, ..., 0.0000, 0.0375, 0.0375]]), 'edges': [[2161, 2161]]}, 2347: {'node_feat': tensor([[0.0000, 0.0000, 0.0376, ..., 0.0376, 0.0000, 0.0376]]), 'edges': [[2347, 2347]]}, 2384: {'node_feat': tensor([[0.0361, 0.0000, 0.0000, ..., 0.0000, 0.0000, 0.0361]]), 'edges': [[2384, 2384]]}, 1967: {'node_feat': tensor([[0.0361, 0.0000, 0.0000, ..., 0.0361, 0.0361, 0.0000]]), 'edges': [[1967, 1967]]}, 1976: {'node_feat': tensor([[0.0000, 0.0000, 0.0370, ..., 0.0370, 0.0000, 0.0000]]), 'edges': [[1976, 1976]]}, 2328: {'node_feat': tensor([[0.0000, 0.0000, 0.0370, ..., 0.0000, 0.0370, 0.0370]]), 'edges': [[2328, 2328]]}, 2259: {'node_feat': tensor([[0.0356, 0.0000, 0.0000, ..., 0.0356, 0.0356, 0.0356]]), 'edges': [[2259, 2259]]}, 2151: {'node_feat': tensor([[0.0000, 0.0368, 0.0368, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2151, 2151]]}, 2048: {'node_feat': tensor([[0.0365, 0.0000, 0.0365, ..., 0.0365, 0.0000, 0.0365]]), 'edges': [[2048, 2048]]}, 2267: {'node_feat': tensor([[0.0374, 0.0374, 0.0374, ..., 0.0374, 0.0374, 0.0374]]), 'edges': [[2267, 2267]]}, 1879: {'node_feat': tensor([[0.0371, 0.0000, 0.0371, ..., 0.0371, 0.0000, 0.0000]]), 'edges': [[1879, 1879]]}, 2043: {'node_feat': tensor([[0.0362, 0.0362, 0.0000, ..., 0.0000, 0.0000, 0.0362]]), 'edges': [[2043, 2043]]}, 2294: {'node_feat': tensor([[0.0000, 0.0365, 0.0365, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2294, 2294]]}, 1856: {'node_feat': tensor([[0.0359, 0.0000, 0.0000, ..., 0.0359, 0.0000, 0.0359]]), 'edges': [[1856, 1856]]}, 2517: {'node_feat': tensor([[0.0000, 0.0366, 0.0000, ..., 0.0000, 0.0366, 0.0000]]), 'edges': [[2517, 2517]]}, 1735: {'node_feat': tensor([[0.0000, 0.0382, 0.0382, ..., 0.0382, 0.0000, 0.0382]]), 'edges': [[1735, 1735]]}, 2653: {'node_feat': tensor([[0.0357, 0.0000, 0.0000, ..., 0.0357, 0.0357, 0.0000]]), 'edges': [[2653, 2653]]}, 2053: {'node_feat': tensor([[0.0000, 0.0369, 0.0000, ..., 0.0369, 0.0369, 0.0000]]), 'edges': [[2053, 2053]]}, 2353: {'node_feat': tensor([[0.0365, 0.0365, 0.0000, ..., 0.0365, 0.0000, 0.0365]]), 'edges': [[2353, 2353]]}, 1797: {'node_feat': tensor([[0.0361, 0.0361, 0.0361, ..., 0.0000, 0.0000, 0.0361]]), 'edges': [[1797, 1797]]}, 2026: {'node_feat': tensor([[0.0370, 0.0370, 0.0000, ..., 0.0370, 0.0370, 0.0000]]), 'edges': [[2026, 2026]]}, 2321: {'node_feat': tensor([[0.0364, 0.0000, 0.0364, ..., 0.0364, 0.0000, 0.0364]]), 'edges': [[2321, 2321]]}, 2278: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0367, 0.0000, 0.0367]]), 'edges': [[2278, 2278]]}, 2350: {'node_feat': tensor([[0.0000, 0.0359, 0.0000, ..., 0.0359, 0.0000, 0.0000]]), 'edges': [[2350, 2350]]}, 2092: {'node_feat': tensor([[0.0379, 0.0000, 0.0379, ..., 0.0379, 0.0000, 0.0379]]), 'edges': [[2092, 2092]]}, 1972: {'node_feat': tensor([[0.0000, 0.0371, 0.0371, ..., 0.0000, 0.0000, 0.0371]]), 'edges': [[1972, 1972]]}, 2046: {'node_feat': tensor([[0.0362, 0.0362, 0.0000, ..., 0.0362, 0.0362, 0.0362]]), 'edges': [[2046, 2046]]}, 2322: {'node_feat': tensor([[0.0358, 0.0358, 0.0000, ..., 0.0358, 0.0000, 0.0358]]), 'edges': [[2322, 2322]]}, 1897: {'node_feat': tensor([[0.0373, 0.0373, 0.0000, ..., 0.0373, 0.0000, 0.0373]]), 'edges': [[1897, 1897]]}, 2298: {'node_feat': tensor([[0.0374, 0.0000, 0.0374, ..., 0.0374, 0.0000, 0.0000]]), 'edges': [[2298, 2298]]}, 2553: {'node_feat': tensor([[0.0000, 0.0000, 0.0362, ..., 0.0362, 0.0362, 0.0362]]), 'edges': [[2553, 2553]]}, 2598: {'node_feat': tensor([[0.0357, 0.0000, 0.0357, ..., 0.0357, 0.0357, 0.0357]]), 'edges': [[2598, 2598]]}, 1851: {'node_feat': tensor([[0.0357, 0.0357, 0.0000, ..., 0.0357, 0.0357, 0.0357]]), 'edges': [[1851, 1851]]}, 2536: {'node_feat': tensor([[0.0000, 0.0359, 0.0000, ..., 0.0359, 0.0359, 0.0359]]), 'edges': [[2536, 2536]]}, 2619: {'node_feat': tensor([[0.0000, 0.0000, 0.0368, ..., 0.0000, 0.0368, 0.0368]]), 'edges': [[2619, 2619]]}, 2377: {'node_feat': tensor([[0.0361, 0.0361, 0.0361, ..., 0.0361, 0.0361, 0.0361]]), 'edges': [[2377, 2377]]}, 2156: {'node_feat': tensor([[0.0000, 0.0367, 0.0000, ..., 0.0000, 0.0367, 0.0367]]), 'edges': [[2156, 2156]]}, 1831: {'node_feat': tensor([[0.0370, 0.0370, 0.0000, ..., 0.0370, 0.0370, 0.0370]]), 'edges': [[1831, 1831]]}, 2218: {'node_feat': tensor([[0.0000, 0.0372, 0.0372, ..., 0.0372, 0.0000, 0.0372]]), 'edges': [[2218, 2218]]}, 2325: {'node_feat': tensor([[0.0000, 0.0358, 0.0358, ..., 0.0358, 0.0000, 0.0358]]), 'edges': [[2325, 2325]]}, 1975: {'node_feat': tensor([[0.0000, 0.0358, 0.0000, ..., 0.0358, 0.0358, 0.0358]]), 'edges': [[1975, 1975]]}, 2638: {'node_feat': tensor([[0.0367, 0.0367, 0.0000, ..., 0.0367, 0.0367, 0.0000]]), 'edges': [[2638, 2638]]}, 1891: {'node_feat': tensor([[0.0364, 0.0364, 0.0364, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[1891, 1891]]}, 2332: {'node_feat': tensor([[0.0000, 0.0361, 0.0000, ..., 0.0361, 0.0000, 0.0361]]), 'edges': [[2332, 2332]]}, 2271: {'node_feat': tensor([[0.0000, 0.0000, 0.0371, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2271, 2271]]}, 2362: {'node_feat': tensor([[0.0000, 0.0357, 0.0000, ..., 0.0357, 0.0357, 0.0357]]), 'edges': [[2362, 2362]]}, 2190: {'node_feat': tensor([[0.0000, 0.0359, 0.0000, ..., 0.0359, 0.0000, 0.0000]]), 'edges': [[2190, 2190]]}, 2594: {'node_feat': tensor([[0.0000, 0.0000, 0.0357, ..., 0.0000, 0.0000, 0.0357]]), 'edges': [[2594, 2594]]}, 1981: {'node_feat': tensor([[0.0000, 0.0358, 0.0000, ..., 0.0358, 0.0358, 0.0358]]), 'edges': [[1981, 1981]]}, 1900: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0357, 0.0000, 0.0357]]), 'edges': [[1900, 1900]]}, 2093: {'node_feat': tensor([[0.0000, 0.0356, 0.0000, ..., 0.0356, 0.0356, 0.0356]]), 'edges': [[2093, 2093]]}, 2665: {'node_feat': tensor([[0.0000, 0.0352, 0.0352, ..., 0.0000, 0.0352, 0.0352]]), 'edges': [[2665, 2665]]}, 2623: {'node_feat': tensor([[0.0000, 0.0359, 0.0000, ..., 0.0359, 0.0359, 0.0000]]), 'edges': [[2623, 2623]]}, 1919: {'node_feat': tensor([[0.0357, 0.0357, 0.0000, ..., 0.0357, 0.0357, 0.0357]]), 'edges': [[1919, 1919]]}, 2002: {'node_feat': tensor([[0.0000, 0.0351, 0.0000, ..., 0.0351, 0.0351, 0.0000]]), 'edges': [[2002, 2002]]}, 2272: {'node_feat': tensor([[0.0362, 0.0000, 0.0362, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2272, 2272]]}, 2297: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0357, 0.0000, 0.0357]]), 'edges': [[2297, 2297]]}, 2677: {'node_feat': tensor([[0.0000, 0.0363, 0.0363, ..., 0.0363, 0.0000, 0.0000]]), 'edges': [[2677, 2677]]}, 1805: {'node_feat': tensor([[0.0000, 0.0000, 0.0350, ..., 0.0350, 0.0350, 0.0000]]), 'edges': [[1805, 1805]]}, 1724: {'node_feat': tensor([[0.0348, 0.0348, 0.0348, ..., 0.0348, 0.0348, 0.0348]]), 'edges': [[1724, 1724]]}, 1899: {'node_feat': tensor([[0.0000, 0.0366, 0.0366, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[1899, 1899]]}, 1839: {'node_feat': tensor([[0.0000, 0.0349, 0.0000, ..., 0.0349, 0.0349, 0.0349]]), 'edges': [[1839, 1839]]}, 2171: {'node_feat': tensor([[0.0365, 0.0000, 0.0000, ..., 0.0365, 0.0365, 0.0365]]), 'edges': [[2171, 2171]]}, 2324: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0356, 0.0000, 0.0356]]), 'edges': [[2324, 2324]]}, 2096: {'node_feat': tensor([[0.0000, 0.0349, 0.0000, ..., 0.0349, 0.0000, 0.0349]]), 'edges': [[2096, 2096]]}, 2480: {'node_feat': tensor([[0.0359, 0.0000, 0.0000, ..., 0.0359, 0.0000, 0.0000]]), 'edges': [[2480, 2480]]}, 2479: {'node_feat': tensor([[0.0000, 0.0000, 0.0369, ..., 0.0000, 0.0000, 0.0000]]), 'edges': [[2479, 2479]]}, 2127: {'node_feat': tensor([[0.0350, 0.0350, 0.0350, ..., 0.0350, 0.0350, 0.0350]]), 'edges': [[2127, 2127]]}, 1800: {'node_feat': tensor([[0.0365, 0.0000, 0.0000, ..., 0.0365, 0.0365, 0.0365]]), 'edges': [[1800, 1800]]}, 2232: {'node_feat': tensor([[0.0367, 0.0367, 0.0000, ..., 0.0000, 0.0367, 0.0367]]), 'edges': [[2232, 2232]]}, 1921: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0360, 0.0360, 0.0360]]), 'edges': [[1921, 1921]]}, 2516: {'node_feat': tensor([[0.0352, 0.0352, 0.0000, ..., 0.0352, 0.0352, 0.0352]]), 'edges': [[2516, 2516]]}, 2327: {'node_feat': tensor([[0.0357, 0.0357, 0.0000, ..., 0.0357, 0.0357, 0.0000]]), 'edges': [[2327, 2327]]}, 2021: {'node_feat': tensor([[0.0355, 0.0000, 0.0355, ..., 0.0355, 0.0000, 0.0355]]), 'edges': [[2021, 2021]]}, 2326: {'node_feat': tensor([[0.0354, 0.0354, 0.0000, ..., 0.0354, 0.0000, 0.0354]]), 'edges': [[2326, 2326]]}, 2087: {'node_feat': tensor([[0.0356, 0.0356, 0.0356, ..., 0.0356, 0.0356, 0.0000]]), 'edges': [[2087, 2087]]}, 1790: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0353, 0.0353, 0.0353]]), 'edges': [[1790, 1790]]}, 2260: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0350, 0.0000, 0.0350]]), 'edges': [[2260, 2260]]}, 2575: {'node_feat': tensor([[0.0375, 0.0000, 0.0375, ..., 0.0000, 0.0375, 0.0000]]), 'edges': [[2575, 2575]]}, 2417: {'node_feat': tensor([[0.0360, 0.0360, 0.0360, ..., 0.0360, 0.0360, 0.0360]]), 'edges': [[2417, 2417]]}, 2548: {'node_feat': tensor([[0.0372, 0.0000, 0.0372, ..., 0.0372, 0.0000, 0.0000]]), 'edges': [[2548, 2548]]}, 1917: {'node_feat': tensor([[0.0000, 0.0000, 0.0000, ..., 0.0376, 0.0376, 0.0376]]), 'edges': [[1917, 1917]]}, 2262: {'node_feat': tensor([[0.0357, 0.0357, 0.0000, ..., 0.0357, 0.0000, 0.0357]]), 'edges': [[2262, 2262]]}, 2428: {'node_feat': tensor([[0.0370, 0.0370, 0.0000, ..., 0.0370, 0.0000, 0.0000]]), 'edges': [[2428, 2428]]}, 2255: {'node_feat': tensor([[0.0383, 0.0000, 0.0383, ..., 0.0383, 0.0383, 0.0000]]), 'edges': [[2255, 2255]]}, 2337: {'node_feat': tensor([[0.0361, 0.0361, 0.0000, ..., 0.0361, 0.0000, 0.0361]]), 'edges': [[2337, 2337]]}}

Shoule feature budget calculated before or after feature normalization?

Hi, thank you for your excellent work! I have some confusion regarding the calculation of env.feature_budget:
In line 67 of attack_utils.py:
self.feature_budget = (self.g.ndata['feat']>0).float().sum(1).mean() if self.discrete_feat else self.g.ndata['feat'].sum(1).mean()
Note in line 39, the feature is normalized:
self.g.ndata['feat'] = F.normalize(self.g.ndata['feat'])

In the dataset with discrete features ,the self.feature_budget is calculated through the original feature while in continuous features, the budget is calcluated through normalized feature.

Why is there a difference in the calculation of env.feature_budget?

Difference results with G-NIA

Thanks for your wonderful Job. However, Why the result in G-NIA different so much with your results when in black box condition

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.