Skip to content

attribute_inference_protection

attribute_inference_protection

Classes:

Name Description
AttributeInferenceProtection

Attribute Inference Protection privacy metric.

AttributeInferenceProtection pydantic-model

Bases: Component

Attribute Inference Protection privacy metric.

Simulates an attribute inference attack: given quasi-identifier columns, can an adversary use synthetic nearest-neighbors to predict the remaining attributes of a training record? A higher score indicates better protection (lower prediction accuracy).

See Also

https://arxiv.org/abs/2501.03941 -- Synthetic Data Privacy Metrics.

Config:

  • arbitrary_types_allowed: True

Fields:

col_accuracy_df = None pydantic-field

Per-column prediction risk scores and grades.

jinja_context cached property

Template context with the attribute-inference bar chart figure.

from_evaluation_dataset(evaluation_dataset, config=None) staticmethod

Run the attribute inference attack and return the protection score.

Source code in src/nemo_safe_synthesizer/evaluation/components/attribute_inference_protection.py
@staticmethod
def from_evaluation_dataset(
    evaluation_dataset: EvaluationDataset, config: SafeSynthesizerParameters | None = None
) -> AttributeInferenceProtection:
    """Run the attribute inference attack and return the protection score."""
    quasi_identifier_count = config.evaluation.quasi_identifier_count if config else QUASI_IDENTIFIER_COUNT

    score, col_accuracy_df = AttributeInferenceProtection._aia(
        df_train=evaluation_dataset.reference,
        df_synth=evaluation_dataset.output,
        quasi_identifier_count=quasi_identifier_count,
    )
    return AttributeInferenceProtection(score=score, col_accuracy_df=col_accuracy_df)