pe.callback.common.compute_precision_recall module

class pe.callback.common.compute_precision_recall.ComputePrecisionRecall(priv_data, embedding, num_precision_neighbors=4, num_recall_neighbors=5, filter_criterion=None)[source]

Bases: Callback

The callback that computes precision and recall metrics (https://arxiv.org/abs/1904.06991) between the private and synthetic data.

__call__(syn_data)[source]

This function is called after each PE iteration that computes the FID between the private and synthetic data.

Parameters:

syn_data (pe.data.Data) – The synthetic data

Returns:

The FID between the private and synthetic data

Return type:

list[pe.metric_item.FloatMetricItem]

__init__(priv_data, embedding, num_precision_neighbors=4, num_recall_neighbors=5, filter_criterion=None)[source]

Constructor.

Parameters:
  • priv_data (pe.data.Data) – The private data

  • embedding (pe.embedding.Embedding) – The embedding to compute the FID

  • num_precision_neighbors (int, optional) – The number of neighbors to use for computing precision, defaults to 4 following https://github.com/marcojira/fld/tree/main

  • num_recall_neighbors (int, optional) – The number of neighbors to use for computing recall, defaults to 5 following https://github.com/marcojira/fld/tree/main

  • filter_criterion (dict, optional) – Only computes the metric based on samples satisfying the criterion. None means no filtering. Defaults to None