Fréchet Distance

polygraph.metrics.base.FrechetDistance

Bases: GenerationMetric[GraphType], Generic[GraphType]

Computes Frechet distance between reference and generated graphs.

The Frechet distance is computed by fitting Gaussian distributions to graph descriptors of reference and generated graphs and computing the 2-Wasserstein distance between these two distributions.

Parameters:
  • reference_graphs (Collection[GraphType]) –

    Collection of graphs to compare against

  • descriptor_fn (Callable[[Collection[GraphType]], ndarray]) –

    Function that computes descriptors for a collection of graphs

compute(generated_graphs)

Computes Frechet distance between reference and generated graphs.

Parameters:
  • generated_graphs (Collection[GraphType]) –

    Collection of graphs to evaluate

Returns:
  • float

    Frechet distance between reference and generated graphs