Code and Software
Graph Random Neural Features
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.
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)
and a PyTorch Geometric one:
from grnf.torch import GraphRandomNeuralFeatures grnf = GraphRandomNeuralFeatures(64) z = grnf(data)
CDG: Change Detection in a sequence of Graphs.
This is the reference code for most of my publications. It is an integrated collection of tools for performing change detection. For further details please visit the GitHub repository.
The code is written in
In the package you will find following folders
cdg/graphinterface for datasets of graphs, distances and kernels.
cdg/embeddingseveral types of vector and manifold representations of graphs, such as, dissimilarity representation and manifold embeddings, like [zambon2018anomaly].
cdg/changedetectiontests for change detection, like [zambon2018concept, zambon2019change].
cdg/utilsutilities for the module.
cdg/simulationutilities for running repeated experiments.
I have set up a notebook on GitHub for you:
Here a snippet of code to perform a change-detection test on a sequence
from cdg.changedetection import GaussianCusum cdt = GaussianCusum() cdt.fit(x[:N_train]) y = cdt.predict(x[N_train:])