Graph Random Neural Features (GRNF) is an embedding method from graph-structured data to real vectors based on a family of graph neural networks. GRNF can be used within traditional processing methods or as a training-free input layer of a graph neural network. The theoretical guarantees that accompany GRNF ensure that the considered graph distance is metric, hence allowing to distinguish any pair of non-isomorphic graphs, and that GRNF approximately preserves its metric structure.
The following is the reference paper:
@inproceedings{zambon2020graph,
title={Graph Random Neural Features for Distance-Preserving Graph Representations},
author={Zambon, Daniele and Alippi, Cesare and Livi, Lorenzo},
booktitle={Proceedings of the 37th International Conference on Machine Learning (ICML)},
pages={10968--10977},
editor={Hal Daumé III and Aarti Singh},
volume={119},
series={Proceedings of Machine Learning Research},
address={Virtual},
year={2020},
month={13--18 Jul},
publisher={PMLR},
pdf={http://proceedings.mlr.press/v119/zambon20a/zambon20a.pdf},
}
GRNF has both a Spektral (TensorFlow) implementation:
from tensorflow.keras.layers import Input, Dense
from tensorflow.keras.models import Model
from grnf.tf import GraphRandomNeuralFeatures
X_in = Input(shape=(N, F))
A_in = Input(shape=(N, N))
psi = GraphRandomNeuralFeatures(64, activation="relu")([X_in, A_in])
output = Dense(1)(psi)
model = Model(inputs=[X_in, A_in], outputs=output)
as well as a PyTorch Geometric one:
from grnf.torch import GraphRandomNeuralFeatures
grnf = GraphRandomNeuralFeatures(64)
z = grnf(data)
Adapted from Spektral examples:
examples/tf/delaunay_batch.py
: Graph classificationexamples/tf/qm9_batch.py
: Graph regressionexamples/tf/qm9_disjoint.py
: Graph regression
Moreover, in examples/torch
you can find also the code to test GRNF in the gnn-comparison framework.
Please, refer to branch v0.1.0
git checkout v0.1.0
- Improved
pytorch
implementation - Added Spektral implementation working in
batch
anddisjoint
modes. - Added examples
- Experiments of the paper