https://github.com/cgcl-codes/nifa

[NeurIPS 2024] Are Your Models Still Fair? Fairness Attacks on Graph Neural Networks via Node Injections.

https://github.com/cgcl-codes/nifa

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.4%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

[NeurIPS 2024] Are Your Models Still Fair? Fairness Attacks on Graph Neural Networks via Node Injections.

Basic Info
  • Host: GitHub
  • Owner: CGCL-codes
  • Language: Python
  • Default Branch: main
  • Homepage:
  • Size: 306 KB
Statistics
  • Stars: 1
  • Watchers: 3
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created over 1 year ago · Last pushed over 1 year ago
Metadata Files
Readme

readme.md

Implementations for NIFA

This repository includes the implementations for our paper at NeurIPS 2024: Are Your Models Still Fair? Fairness Attacks on Graph Neural Networks via Node Injections.

Framework of NIFA

Environments

Python 3.8.12

Packages:

dgl==0.6.1 dgl_cu110==0.6.1 numpy==1.21.4 torch==1.7.1+cu110 tqdm==4.62.3

Run the following code to install all required packages.

```

pip install -r requirements.txt ```

Datasets & Processed files

  • Due to size limitation, the processed datasets are stored in google drive as data.zip. The datasets include Pokec-z, Pokec-n and DBLP.

  • Download and unzip the data.zip, and the full repository should be as follows:

. ├── code │ ├── attack.py │ ├── main.py │ ├── model.py │ ├── run.sh │ └── utils.py ├── data │ ├── dblp.bin │ ├── pokec_n.bin │ └── pokec_z.bin ├── readme.md └── requirements.txt

Run the codes

Evaluation of classic GNN models

All arguments are properly set below for reproducing our results on four classic GNN models.

``` python main.py --dataset pokec_z --alpha 0.01 --beta 4 --node 102 --edge 50 --before --device 0 --models 'GCN' 'GraphSAGE' 'APPNP' 'SGC'

python main.py --dataset pokec_n --alpha 0.01 --beta 4 --node 87 --edge 50 --before --device 1 --models 'GCN' 'GraphSAGE' 'APPNP' 'SGC'

python main.py --dataset dblp --alpha 0.1 --beta 8 --node 32 --edge 24 --epochs 500 --before --device 2 --models 'GCN' 'GraphSAGE' 'APPNP' 'SGC' ```

Evaluation of fair GNN models

Since FairGNN, FairVGNN, and FairSIN have been independently open-sourced, we have not included a unified integration of these models in our repository yet. For the convenience of reproducing our results on these models, we summarize their official repositories below:

| MODEL | Repository | | ---------- | ---------- | | FairGNN | Github | | FairVGNN | Github | | FairSIN | Github |

Since the dataset processing methods of FairGNN, FairVGNN, and FairSIN are highly similar, after generating the poisoned graph using NIFA, you can use the following code to process the dataset and make it compatible with their repositories for subsequent evaluations:

``` glist, _ = dgl.loadgraphs(f'./output/{args.dataset}poisoned.bin') # load poisoned graph file g = glist[0]

idxtrain = torch.where(g.ndata['trainindex'])[0] idxval = torch.where(g.ndata['valindex'])[0] idxtest = torch.where(g.ndata['testindex'])[0]

features = g.ndata['feature'] labels = g.ndata['label'] sens = g.ndata['sensitive']

adj = sp.coomatrix((np.ones(g.edges()[0].shape[0]), (g.edges()[0], g.edges()[1])), shape=(labels.shape[0], labels.shape[0]), dtype=np.float32) idxsenstrain = idxtrain ```

Licenses

This project is licensed under CC BY-NC-ND 4.0. To view a copy of this license, please visit http://creativecommons.org/licenses/by-nc-nd/4.0/

BibTeX

If you like our work and use the model for your research, please cite our work as follows:

bibtex @inproceedings{luo2024nifa, author = {Luo, Zihan and Huang, Hong and Zhou, Yongkang and Zhang, Jiping and Chen, Nuo and Jin, Hai}, title = {Are Your Models Still Fair? Fairness Attacks on Graph Neural Networks via Node Injections}, booktitle={Thirty-eighth Conference on Neural Information Processing Systems}, year = {2024}, month = {October} }

Owner

  • Name: CGCL-codes
  • Login: CGCL-codes
  • Kind: organization

CGCL/SCTS/BDTS Lab

GitHub Events

Total
  • Watch event: 2
  • Member event: 1
  • Push event: 7
  • Create event: 2
Last Year
  • Watch event: 2
  • Member event: 1
  • Push event: 7
  • Create event: 2

Dependencies

requirements.txt pypi
  • dgl ==0.6.1
  • dgl_cu110 ==0.6.1
  • numpy ==1.21.4
  • torch ==1.7.1
  • tqdm ==4.62.3