gcn-master
所属分类:数值算法/人工智能
开发工具:Python
文件大小:5193KB
下载次数:41
上传日期:2019-01-15 10:38:27
上 传 者:
yysys
说明: 图卷积神经网络实现代码,
python实现了图卷积神经网络的功能。
(the code for gcn
use python
the paper is COVARIANT COMPOSITIONAL NETWORKS FOR LEARNING GRAPHS)
文件列表:
LICENCE (1071, 2018-12-13)
gcn (0, 2018-12-13)
gcn\__init__.py (70, 2018-12-13)
gcn\data (0, 2018-12-13)
gcn\data\ind.citeseer.allx (595021, 2018-12-13)
gcn\data\ind.citeseer.ally (55623, 2018-12-13)
gcn\data\ind.citeseer.graph (61987, 2018-12-13)
gcn\data\ind.citeseer.test.index (5000, 2018-12-13)
gcn\data\ind.citeseer.tx (260321, 2018-12-13)
gcn\data\ind.citeseer.ty (24135, 2018-12-13)
gcn\data\ind.citeseer.x (31087, 2018-12-13)
gcn\data\ind.citeseer.y (3014, 2018-12-13)
gcn\data\ind.cora.allx (257305, 2018-12-13)
gcn\data\ind.cora.ally (47959, 2018-12-13)
gcn\data\ind.cora.graph (59847, 2018-12-13)
gcn\data\ind.cora.test.index (5000, 2018-12-13)
gcn\data\ind.cora.tx (148025, 2018-12-13)
gcn\data\ind.cora.ty (28135, 2018-12-13)
gcn\data\ind.cora.x (22119, 2018-12-13)
gcn\data\ind.cora.y (4054, 2018-12-13)
gcn\data\ind.pubmed.allx (7578385, 2018-12-13)
gcn\data\ind.pubmed.ally (224739, 2018-12-13)
gcn\data\ind.pubmed.graph (471808, 2018-12-13)
gcn\data\ind.pubmed.test.index (6000, 2018-12-13)
gcn\data\ind.pubmed.tx (405505, 2018-12-13)
gcn\data\ind.pubmed.ty (12135, 2018-12-13)
gcn\data\ind.pubmed.x (23172, 2018-12-13)
gcn\data\ind.pubmed.y (854, 2018-12-13)
gcn\inits.py (791, 2018-12-13)
gcn\layers.py (5886, 2018-12-13)
gcn\metrics.py (691, 2018-12-13)
gcn\models.py (6264, 2018-12-13)
gcn\train.py (3891, 2018-12-13)
gcn\utils.py (6500, 2018-12-13)
setup.py (591, 2018-12-13)
# Graph Convolutional Networks
This is a TensorFlow implementation of Graph Convolutional Networks for the task of (semi-supervised) classification of nodes in a graph, as described in our paper:
Thomas N. Kipf, Max Welling, [Semi-Supervised Classification with Graph Convolutional Networks](http://arxiv.org/abs/1609.02907) (ICLR 2017)
For a high-level explanation, have a look at our blog post:
Thomas Kipf, [Graph Convolutional Networks](http://tkipf.github.io/graph-convolutional-networks/) (2016)
## Installation
```bash
python setup.py install
```
## Requirements
* tensorflow (>0.12)
* networkx
## Run the demo
```bash
cd gcn
python train.py
```
## Data
In order to use your own data, you have to provide
* an N by N adjacency matrix (N is the number of nodes),
* an N by D feature matrix (D is the number of features per node), and
* an N by E binary label matrix (E is the number of classes).
Have a look at the `load_data()` function in `utils.py` for an example.
In this example, we load citation network data (Cora, Citeseer or Pubmed). The original datasets can be found here: http://linqs.cs.umd.edu/projects/projects/lbc/. In our version (see `data` folder) we use dataset splits provided by https://github.com/kimiyoung/planetoid (Zhilin Yang, William W. Cohen, Ruslan Salakhutdinov, [Revisiting Semi-Supervised Learning with Graph Embeddings](https://arxiv.org/abs/1603.08861), ICML 2016).
You can specify a dataset as follows:
```bash
python train.py --dataset citeseer
```
(or by editing `train.py`)
## Models
You can choose between the following models:
* `gcn`: Graph convolutional network (Thomas N. Kipf, Max Welling, [Semi-Supervised Classification with Graph Convolutional Networks](http://arxiv.org/abs/1609.02907), 2016)
* `gcn_cheby`: Chebyshev polynomial version of graph convolutional network as described in (Michal Defferrard, Xavier Bresson, Pierre Vandergheynst, [Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering](https://arxiv.org/abs/1606.09375), NIPS 2016)
* `dense`: Basic multi-layer perceptron that supports sparse inputs
## Graph classification
Our framework also supports batch-wise classification of multiple graph instances (of potentially different size) with an adjacency matrix each. It is best to concatenate respective feature matrices and build a (sparse) block-diagonal matrix where each block corresponds to the adjacency matrix of one graph instance. For pooling (in case of graph-level outputs as opposed to node-level outputs) it is best to specify a simple pooling matrix that collects features from their respective graph instances, as illustrated below:
![graph_classification](https://user-images.githubusercontent.com/7347296/341***790-eb5bec96-e56b-11e7-90d5-157800e042de.png)
## Cite
Please cite our paper if you use this code in your own work:
```
@inproceedings{kipf2017semi,
title={Semi-Supervised Classification with Graph Convolutional Networks},
author={Kipf, Thomas N. and Welling, Max},
booktitle={International Conference on Learning Representations (ICLR)},
year={2017}
}
```
近期下载者:
相关文件:
收藏者: