{"id":19585519,"url":"https://github.com/safe-graph/riognn","last_synced_at":"2025-07-18T01:05:22.937Z","repository":{"id":62302582,"uuid":"357766947","full_name":"safe-graph/RioGNN","owner":"safe-graph","description":"Reinforced Neighborhood Selection Guided Multi-Relational Graph Neural Networks","archived":false,"fork":false,"pushed_at":"2024-09-18T06:45:38.000Z","size":40501,"stargazers_count":75,"open_issues_count":2,"forks_count":6,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-04-02T11:57:55.982Z","etag":null,"topics":["fraud-detection","graph-algorithms","graph-neural-networks","machine-learning-algorithms","medical-data","reinforcement-learning"],"latest_commit_sha":null,"homepage":"http://arxiv.org/abs/2104.07886","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/safe-graph.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-04-14T03:56:32.000Z","updated_at":"2025-04-01T14:51:38.000Z","dependencies_parsed_at":"2025-03-16T16:10:46.364Z","dependency_job_id":"aef293b4-7e91-43fd-87ee-e6d87181da3b","html_url":"https://github.com/safe-graph/RioGNN","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/safe-graph%2FRioGNN","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/safe-graph%2FRioGNN/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/safe-graph%2FRioGNN/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/safe-graph%2FRioGNN/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/safe-graph","download_url":"https://codeload.github.com/safe-graph/RioGNN/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248599570,"owners_count":21131311,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fraud-detection","graph-algorithms","graph-neural-networks","machine-learning-algorithms","medical-data","reinforcement-learning"],"created_at":"2024-11-11T07:54:59.572Z","updated_at":"2025-04-12T16:43:26.351Z","avatar_url":"https://github.com/safe-graph.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RioGNN\n\nCode for [**Reinforced Neighborhood Selection Guided Multi-Relational Graph Neural Networks**](https://arxiv.org/pdf/2104.07886.pdf).  \n\n[Hao Peng](https://penghao-buaa.github.io/), Ruitong Zhang, [Yingtong Dou](http://ytongdou.com/), Renyu Yang, Jingyi Zhang, [Philip S. Yu](https://www.cs.uic.edu/PSYu/).\n\n\n## Repo Structure\n\nThe repository is organized as follows:\n- `data/`: dataset folder\n    - `YelpChi.zip`: Data of the dataset Yelp;\n    - `Amazon.zip`: Data of the dataset Amazon;\n    - `Mimic.zip`: Data of the dataset Mimic;\n- `log/`: log folder\n- `model/`: model folder\n    - `graphsage.py`: model code for vanilla [GraphSAGE](https://github.com/williamleif/graphsage-simple/) model;\n    - `layers.py`: RioGNN layers implementations;\n    - `model.py`: RioGNN model implementations;\n- `RL/`: RL folder\n    - `actor_critic.py`: RL algorithm, [Actor-Critic](https://github.com/llSourcell/actor_critic);\n    - `rl_model.py`: RioGNN RL Forest implementations;\n- `utils/`: functions folder\n    - `data_process.py`: transfer sparse matrix to adjacency lists;\n    - `utils.py`: utility functions for data i/o and model evaluation;\n- `train.py`: training and testing all models\n\n\n## Example Dataset\n\nWe build different multi-relational graphs for experiments in two task scenarios and three datasets: \n\n| Dataset  | Task  | Nodes  | Relation  |\n|-------|--------|--------|--------|\n| Yelp  | Fraud Detection | 45,954  | rur, rtr, rsr, homo |\n| Amazon  | Fraud Detection | 11,944  | upu, usu, uvu, homo |\n| MIMIC-III  | Diabetes Diagnosis | 28,522  | vav, vdv, vpv, vmv, homo |\n\n## Run on your Datasets\n\nTo run RioGNN on your datasets, you need to prepare the following data:\n\n- Multiple-single relation graphs with the same nodes where each graph is stored in `scipy.sparse` matrix format, you can use `sparse_to_adjlist()` in `utils.py` to transfer the sparse matrix into adjacency lists used by RioGNN;\n- A numpy array with node labels. Currently, RioGNN only supports binary classification;\n- A node feature matrix stored in `scipy.sparse` matrix format. \n\n\n## How to Run\nYou can download the project and and run the program as follows:\n\n###### 1. The dataset folder `\\data` only contains two Fraud datasets, please use the following links to download the Mimic dataset (~700MB);\n\nGoogle Drive: https://drive.google.com/file/d/1WvYtNSHcvSQr8fzI9ykpgjMBSPwCTW0h/view?usp=sharing\n\nBaidu Cloud: https://pan.baidu.com/s/1iyaOqnkyYGqo1Mdwt4QYnQ Password: `vbwn`\n\n\\* Note that all datasets need to be unzipped in the folder `\\data` first;\n###### 2. Install the required packages using the `requirements.txt`;\n```bash\npip3 install -r requirements.txt\n```\n###### 3. Run `data_process.py` to generate adjacency lists of different dataset used by RioGNN;\n```bash\npython data_process.py\n```\n###### 4. Run `train.py` to run RioGNN with default settings.\n```bash\npython train.py\n```\n\n\\* To run the code, you need to have at least **Python 3.6** or later versions. \n\n## Important Parameters\n\n- Our model supports both CPU and GPU mode, you can change it through parameter `--use_cuda` and  `--device`:\n- Set the `--data` as `yelp`, `amazon` or `mimic` to change different dataset.\n- Parameter `--num_epochs` is used to set the maximum number of iterative epochs. \nNote that the model will stop early when reinforcement learning has explored all depths.\n- The default value of parameter `--ALAPHA` is `10`, \nwhich means that the accuracy of different depths of reinforcement learning tree will be progressive with \n0.1, 0.01, 0.001, etc. \nIf you want to conduct more width and depth experiments, please adjust here.\n\n\\* For other dataset and parameter settings, please refer to the arg parser in `train.py`. \n\n\n## Preliminary Work\n\nOur preliminary work, **CA**mouflage-**RE**sistant **G**raph **N**eural **N**etwork \n**([CARE-GNN](https://github.com/YingtongDou/CARE-GNN))**,\nis a GNN-based fraud detector based on a multi-relation graph equipped with three modules that \nenhance its performance against camouflaged fraudsters.\n\n\n\n\n## Citation\nIf you use our code, please cite the paper below:\n```bibtex\n@article{peng2021reinforced,\n  title={Reinforced Neighborhood Selection Guided Multi-Relational Graph Neural Networks},\n  author={Peng, Hao and Zhang, Ruitong and Dou, Yingtong and Yang, Renyu and Zhang, Jingyi and Yu, Philip S.},\n  journal={ACM Transactions on Information Systems (TOIS)},\n  year={2021}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsafe-graph%2Friognn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsafe-graph%2Friognn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsafe-graph%2Friognn/lists"}