RBF MMD Metrics

MMD metrics using RBF kernels with dynamic bandwidths, as proposed by Thompson et al. [1].

The following graph descriptors are available:

Graph Descriptors

Below, we demonstrate how to evaluate all metrics in the benchmark with point estimates and with uncertainty quantification.

from polygraph.datasets import PlanarGraphDataset, SBMGraphDataset
from polygraph.metrics import RBFMMD2Benchmark, RBFMMD2BenchmarkInterval

reference = list(PlanarGraphDataset("val").to_nx())
generated = list(SBMGraphDataset("val").to_nx())

# Evaluate the benchmark with point estimates
benchmark = RBFMMD2Benchmark(reference[:20])
print(benchmark.compute(generated[:20]))

# Evaluate the benchmark with uncertainty quantification
benchmark_with_uncertainty = RBFMMD2BenchmarkInterval(
    reference,
    subsample_size=20,
    num_samples=100,
    coverage=0.95,
)
print(benchmark_with_uncertainty.compute(generated))
References

[1] Thompson, R., Knyazev, B., Ghalebi, E., Kim, J., & Taylor, G. W. (2022). On Evaluation Metrics for Graph Generative Models. In International Conference on Learning Representations (ICLR).

Summary Benchmark

polygraph.metrics.RBFMMD2Benchmark

Bases: MetricCollection[Graph]

Collection of MMD2 metrics using RBF kernels with dynamic bandwidths.

Parameters:
  • reference_graphs (Collection[Graph]) –

    Collection of reference networkx graphs.

polygraph.metrics.RBFMMD2BenchmarkInterval

Bases: MetricCollection[Graph]

Collection of MMD2 metrics using RBF kernels with dynamic bandwidths and uncertainty quantification.

Parameters:
  • reference_graphs (Collection[Graph]) –

    Collection of reference networkx graphs.

  • subsample_size (int) –

    Number of graphs used in each individual MMD2 sample. Should be consistent with the sample size in point estimates.

  • num_samples (int, default: 500 ) –

    Number of MMD2 samples used to compute the uncertainty interval.

  • coverage (Optional[float], default: 0.95 ) –

    Coverage of the uncertainty interval.

Orbit Counts

Metrics based on counting graph orbits (small subgraph patterns).

polygraph.metrics.rbf_mmd.RBFOrbitMMD2

Bases: MaxDescriptorMMD2[Graph]

polygraph.metrics.rbf_mmd.RBFOrbitMMD2Interval

Degree Distribution

Metrics based on the distribution of node degrees in the graph.

polygraph.metrics.rbf_mmd.RBFDegreeMMD2

Bases: MaxDescriptorMMD2[Graph]

polygraph.metrics.rbf_mmd.RBFDegreeMMD2Interval

Clustering Coefficients

Metrics based on local clustering patterns in the graph.

polygraph.metrics.rbf_mmd.RBFClusteringMMD2

Bases: MaxDescriptorMMD2[Graph]

polygraph.metrics.rbf_mmd.RBFClusteringMMD2Interval

Spectral Properties

Metrics based on the eigenvalue spectrum of the graph.

polygraph.metrics.rbf_mmd.RBFSpectralMMD2

Bases: MaxDescriptorMMD2[Graph]

polygraph.metrics.rbf_mmd.RBFSpectralMMD2Interval

GNN Features

Metrics based on features of a randomly initialized GIN network.

polygraph.metrics.rbf_mmd.RBFGraphNeuralNetworkMMD2

Bases: MaxDescriptorMMD2[Graph]

polygraph.metrics.rbf_mmd.RBFGraphNeuralNetworkMMD2Interval