Implements graph convolution keras layers based on Michaël Defferrard, Xavier Bresson, Pierre Vandergheynst, Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering, Neural Information Processing Systems (NIPS), 2016.
Project description
ChebyGCN
pip install ChebyGCN
Notice, for training and testing data, permutations of the data must be done in a certain way to align with pooling of the graph lapacian. Further, every level of graph corsening is a pool of size two, thus if you want to pool by 2 and then 4, you need log_2(2 * 4)= 3 levels. You will also need to index your Lapancians as seen below.
from ChebyGCN import layers, coarsening
A = scipy.sparse.csr.csr_matrix(A) #load adjanecy matrix
graphs, perm = coarsening.coarsen(A, levels=3, self_connections=True) #produce graph coarsenings
X_train = coarsening.perm_data(X_train, perm)
X_test = coarsening.perm_data(X_test, perm)
L = [coarsening.laplacian(A, normalized=True) for A in graphs]
x_input = Input(shape=(X_train.shape[1],))
x = Reshape((X_train.shape[1],1))(x_input)
x = layers.GraphConvolution( 8, 2, 20, L[0])(x)
x = layers.GraphConvolution( 8, 4, 10, L[2])(x)
x = Flatten()(x)
x = Dense(66, activation='softmax')(x)
This code is 96% based on https://github.com/mdeff/cnn_graph Michaël Defferrard, Xavier Bresson, Pierre Vandergheynst, Convolutional Neural Networks on Graphs with Fast Localized Spectral Filtering, Neural Information Processing Systems (NIPS), 2016.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file ChebyGCN-0.0.3.tar.gz
.
File metadata
- Download URL: ChebyGCN-0.0.3.tar.gz
- Upload date:
- Size: 6.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e882a07d983d4d97d38507e7519a65fa64450c9bb0f26aa4a59ab0f5843321c1 |
|
MD5 | 3032c7acce08b8ec66de50eff86c6a12 |
|
BLAKE2b-256 | ce5c44ee685d452af7324c6685850ac8a2cc3e5d2a2bc2dea55cdd9a2816ab90 |