Danger

You are looking at the documentation for an older version of the SDV! We are no longer supporting or maintaining this version of the software

Click here to go to the new docs pages.

sdv.metrics.tabular.NumericalMLP.compute

classmethod NumericalMLP.compute(real_data, synthetic_data, metadata=None, key_fields=None, sensitive_fields=None, model_kwargs=None, loss_function=None, loss_function_kwargs=None)

Compute this metric.

This fits an adversial attacker model on the synthetic data and then evaluates it making predictions on the real data.

A key_fields column(s) name must be given, either directly or as a first level entry in the metadata dict, which will be used as the key column(s) for the attack.

A sensitive_fields column(s) name must be given, either directly or as a first level entry in the metadata dict, which will be used as the sensitive column(s) for the attack.

Parameters
  • real_data (Union[numpy.ndarray, pandas.DataFrame]) – The values from the real dataset.

  • synthetic_data (Union[numpy.ndarray, pandas.DataFrame]) – The values from the synthetic dataset.

  • metadata (dict) – Table metadata dict. If not passed, it is build based on the real_data fields and dtypes.

  • key_fields (list(str)) – Name of the column(s) to use as the key attributes.

  • sensitive_fields (list(str)) – Name of the column(s) to use as the sensitive attributes.

  • model_kwargs (dict) – Key word arguments of the attacker model. cls.MODEL_KWARGS will be used if none is provided.

  • loss_function (Class) – The loss function to use. cls.LOSS_FUNCTION will be used if none is provided.

  • loss_function_kwargs (dict) – Key word arguments of the loss function. cls.LOSS_FUNCTION_KWARGS will be used if none is provided.

Returns

Scores obtained by the attackers when evaluated on the real data.

Return type

union[float, tuple[float]]