{"id":13628253,"url":"https://github.com/benedekrozemberczki/APPNP","last_synced_at":"2025-04-17T00:33:45.552Z","repository":{"id":102016170,"uuid":"170295133","full_name":"benedekrozemberczki/APPNP","owner":"benedekrozemberczki","description":"A PyTorch implementation of \"Predict then Propagate: Graph Neural Networks meet Personalized PageRank\" (ICLR 2019).","archived":false,"fork":false,"pushed_at":"2022-11-06T21:13:30.000Z","size":1257,"stargazers_count":360,"open_issues_count":1,"forks_count":49,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-08-01T22:42:06.010Z","etag":null,"topics":["appnp","attention","deep-learning","deep-neural-networks","deepwalk","gcn","graph-attention","graph-classification","graph-convolutional-neural-networks","graph-embedding","graph-neural-network","iclr","machine-learning","network-embedding","node-embedding","node2vec","pagerank","ppnp","pytorch","research"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/benedekrozemberczki.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","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},"funding":{"github":["benedekrozemberczki"]}},"created_at":"2019-02-12T10:03:48.000Z","updated_at":"2024-07-28T10:36:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"8ac587fc-38cd-47bc-be7f-3c081098b7e8","html_url":"https://github.com/benedekrozemberczki/APPNP","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FAPPNP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FAPPNP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FAPPNP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/benedekrozemberczki%2FAPPNP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/benedekrozemberczki","download_url":"https://codeload.github.com/benedekrozemberczki/APPNP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223735370,"owners_count":17194090,"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":["appnp","attention","deep-learning","deep-neural-networks","deepwalk","gcn","graph-attention","graph-classification","graph-convolutional-neural-networks","graph-embedding","graph-neural-network","iclr","machine-learning","network-embedding","node-embedding","node2vec","pagerank","ppnp","pytorch","research"],"created_at":"2024-08-01T22:00:49.185Z","updated_at":"2024-11-08T18:31:40.104Z","avatar_url":"https://github.com/benedekrozemberczki.png","language":"Python","funding_links":["https://github.com/sponsors/benedekrozemberczki"],"categories":["Uncategorized","Paper implementations｜论文实现","Paper implementations"],"sub_categories":["Uncategorized","Other libraries｜其他库:","Other libraries:"],"readme":"APPNP\n========================\n\n[![Arxiv](https://img.shields.io/badge/ArXiv-1810.05997-orange.svg)](https://arxiv.org/abs/1810.05997) [![codebeat badge](https://codebeat.co/badges/b85b29b2-307e-418e-b704-79804e210111)](https://codebeat.co/projects/github-com-benedekrozemberczki-appnp-master) [![repo size](https://img.shields.io/github/repo-size/benedekrozemberczki/APPNP.svg)](https://github.com/benedekrozemberczki/APPNP/archive/master.zip) [![benedekrozemberczki](https://img.shields.io/twitter/follow/benrozemberczki?style=social\u0026logo=twitter)](https://twitter.com/intent/follow?screen_name=benrozemberczki)\n \nA **PyTorch** implementation of **Predict then Propagate: Graph Neural\nNetworks meet Personalized PageRank (ICLR 2019).**\n\u003cp align=\"center\"\u003e\n  \u003cimg width=\"800\" src=\"ppnp.jpg\"\u003e\n\u003c/p\u003e\n\n\n---------------------\n\n### Abstract\n\n\u003cp align=\"justify\"\u003e\nNeural message passing algorithms for semi-supervised classification on graphs have recently achieved great success. However, these methods only consider nodes that are a few propagation steps away and the size of this utilized neighborhood cannot be easily extended. In this paper, we use the relationship between graph convolutional networks (GCN) and PageRank to derive an improved propagation scheme based on personalized PageRank. We utilize this propagation procedure to construct personalized propagation of neural predictions (PPNP) and its approximation, APPNP. Our model's training time is on par or faster and its number of parameters on par or lower than previous models. It leverages a large, adjustable neighborhood for classification and can be combined with any neural network. We show that this model outperforms several recently proposed methods for semi-supervised classification on multiple graphs in the most thorough study done so far for GCN-like models.\u003c/p\u003e\n\nA PyTorch and Tensorflow implementation is awailable [[here.]](https://github.com/klicperajo/ppnp).\n\nThis repository provides a PyTorch implementation of PPNP and APPNP as described in the paper:\n\n\u003e Predict then Propagate: Graph Neural Networks meet Personalized PageRank.\n\u003e Johannes Klicpera, Aleksandar Bojchevski, Stephan Günnemann.\n\u003e ICLR, 2019.\n\u003e [[Paper]](https://arxiv.org/abs/1810.05997)\n\n### Requirements\nThe codebase is implemented in Python 3.5.2. package versions used for development are just below.\n```\nnetworkx          2.4\ntqdm              4.28.1\nnumpy             1.15.4\npandas            0.23.4\ntexttable         1.5.0\nscipy             1.1.0\nargparse          1.1.0\ntorch             1.1.0\ntorch-scatter     1.4.0\ntorch-sparse      0.4.3\ntorch-cluster     1.4.5\ntorch-geometric   1.3.2\ntorchvision       0.3.0\n```\n### Datasets\n\u003cp align=\"justify\"\u003e\nThe code takes the **edge list** of the graph in a csv file. Every row indicates an edge between two nodes separated by a comma. The first row is a header. Nodes should be indexed starting with 0. A sample graph for `Cora` is included in the  `input/` directory. In addition to the edgelist there is a JSON file with the sparse features and a csv with the target variable.\u003c/p\u003e\n\u003cp align=\"justify\"\u003e\nThe **feature matrix** is a sparse binary one it is stored as a json. Nodes are keys of the json and feature indices are the values. For each node feature column ids are stored as elements of a list. The feature matrix is structured as:\u003c/p\u003e\n\n```javascript\n{ 0: [0, 1, 38, 1968, 2000, 52727],\n  1: [10000, 20, 3],\n  2: [],\n  ...\n  n: [2018, 10000]}\n```\n\nThe **target vector** is a csv with two columns and headers, the first contains the node identifiers the second the targets. This csv is sorted by node identifiers and the target column contains the class meberships indexed from zero. \n\n| **NODE ID**| **Target** |\n| --- | --- |\n| 0 | 3 |\n| 1 | 1 |\n| 2 | 0 |\n| 3 | 1 |\n| ... | ... |\n| n | 3 |\n\n### Options\nTraining an APPNP/PPNP model is handled by the `src/main.py` script which provides the following command line arguments.\n\n#### Input and output options\n```\n  --edge-path       STR    Edge list csv.         Default is `input/cora_edges.csv`.\n  --features-path   STR    Features json.         Default is `input/cora_features.json`.\n  --target-path     STR    Target classes csv.    Default is `input/cora_target.csv`.\n```\n#### Model options\n```\n  --seed              INT     Random seed.                   Defailt is 42.\n  --model             STR     Model exact or approximate.    Default is `exact`.\n  --iterations        INT     APP iterations.                Default is 10.\n  --alpha             FLOAT   Teleport parameter.            Default is 0.1\n  --epochs            INT     Number of training epochs.     Default is 2000.\n  --early-stopping    INT     Early stopping rounds.         Default is 5.\n  --training-size     INT     Training set size.             Default is 1500.\n  --test-size         INT     Test set size.                 Default is 500.\n  --learning-rate     FLOAT   Adam learning rate.            Default is 0.01\n  --dropout           FLOAT   Dropout rate value.            Default is 0.5\n  --lambd             FLOAT   Rgularization parameter.       Default is 0.005.\n  --layers            LST     Layer sizes in first layers.   Default is [64, 64]. \n```\n### Examples\nThe following commands learn a neural network and score on the test set. Training a model on the default dataset.\n```\npython src/main.py\n```\n\u003cp align=\"center\"\u003e\n\u003cimg style=\"float: center;\" src=\"appnp_run.jpg\"\u003e\n\u003c/p\u003e\n\nTraining a PPNP model for a 100 epochs.\n```\npython src/main.py --epochs 100\n```\nTraining an APPNP model.\n```\npython src/main.py --model approximate\n```\nIncreasing the learning rate and the dropout.\n```\npython src/main.py --learning-rate 0.1 --dropout 0.9\n```\n\n--------------------------------------------------------------------------------\n\n**License**\n\n- [GNU License](https://github.com/benedekrozemberczki/APPNP/blob/master/LICENSE)\n\n----------------------------------------------------------------------------\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenedekrozemberczki%2FAPPNP","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbenedekrozemberczki%2FAPPNP","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbenedekrozemberczki%2FAPPNP/lists"}