Validity, Uniqueness, Novelty
Metrics mainly used for evaluating graph generative models on synthetic data.
This module provides VUN, a class for computing the Valid-Unique-Novel (VUN) metrics, which
measure what fraction of generated graphs are:
- Valid: Satisfy domain-specific constraints
- Unique: Not isomorphic to other generated graphs
- Novel: Not isomorphic to training graphs
By passing confidence_level to the constructor, you may also compute Binomial confidence intervals for the proportions.
Example
from polygraph.datasets import PlanarGraphDataset, SBMGraphDataset
from polygraph.metrics import VUN
train = PlanarGraphDataset("val")
generated = SBMGraphDataset("val")
# Without uncertainty quantification
vun = VUN(train.to_nx(), validity_fn=train.is_valid)
print(vun.compute(generated.to_nx())) # {'unique': 1.0, 'novel': 1.0, 'unique_novel': 1.0, 'valid': 0.0, 'valid_unique_novel': 0.0, 'valid_novel': 0.0, 'valid_unique': 0.0}
# With uncertainty quantification
vun = VUN(train.to_nx(), validity_fn=train.is_valid, confidence_level=0.95)
print(vun.compute(generated.to_nx())) # {'unique': ConfidenceInterval(mle=1.0, low=None, high=None), 'novel': ConfidenceInterval(mle=1.0, low=0.8911188393205571, high=1.0), 'unique_novel': ConfidenceInterval(mle=1.0, low=None, high=None), 'valid': ConfidenceInterval(mle=0.0, low=0.0, high=0.10888116067944287), 'valid_unique_novel': ConfidenceInterval(mle=0.0, low=None, high=None), 'valid_novel': ConfidenceInterval(mle=0.0, low=0.0, high=0.10888116067944287), 'valid_unique': ConfidenceInterval(mle=0.0, low=None, high=None
polygraph.metrics.VUN
Bases: GenerationMetric[Graph]
Computes Valid-Unique-Novel metrics for generated graphs.
Measures the fraction of generated graphs that are valid (optional), unique (not isomorphic to other generated graphs), and novel (not isomorphic to training graphs). Also computes confidence intervals for these proportions.
| Parameters: |
|
|---|
compute(generated_graphs)
Computes VUN metrics for a collection of generated graphs.
| Parameters: |
|
|---|
| Returns: |
|
|---|
Raises: ValueError: If generated_samples is empty