compare_synthetic: Compare synthetic data with the real data

compare_syntheticR Documentation

Compare synthetic data with the real data

Description

compare_synthetic() evaluates the fidelity, utility and disclosure risk of a synthetic data set in one call:

  • marginal: marginal_metrics() per variable;

  • association: association_matrix() of both data sets and their difference;

  • utility: pmse() and cross-validated discriminator_auc();

  • privacy: dcr() distance to closest record.

The result has print(), summary(), plot() and ggplot2::autoplot() methods.

Usage

compare_synthetic(
  real,
  synthetic,
  vars = NULL,
  metrics = c("marginal", "association", "utility", "privacy"),
  max_rows = 5000L,
  seed = NULL
)

Arguments

real, synthetic

Data frames (or objects coercible to data frames) with common columns.

vars

Optional subset of variables.

metrics

Which groups of metrics to compute.

max_rows

Maximum rows per data set for the classifier and distance computations.

seed

Optional random seed.

Value

An object of class sp_comparison.

Examples

syn <- synthesize(iris, seed = 1)
cmp <- compare_synthetic(iris, syn, seed = 1)
cmp
plot(cmp, type = "association")

SynthesizerPlus documentation built on Oct. 16, 2026, 5:10 p.m.