Skip to content

Latest commit

 

History

History
151 lines (111 loc) · 4.2 KB

File metadata and controls

151 lines (111 loc) · 4.2 KB

API Reference

This page documents the public Python API for DPSynth. The library is organized into three layers:

  • Domain specification — describing the schema of your tabular data.
  • Constraints — optional cross-attribute restrictions on generated values.
  • Mechanisms — configuring and running differentially private synthesis.

.. currentmodule:: dpsynth.domain

The domain module provides dataclasses for describing the schema of a tabular dataset. Each column is represented by one of the attribute types below. Pass a mapping of column names to attribute objects as the domains argument to :class:`~dpsynth.TabularConfig`.

.. autosummary::
   :toctree: _autosummary
   :nosignatures:
   :template: autosummary/class.rst

   CategoricalAttribute
   NumericalAttribute
   OpenSetCategoricalAttribute
   FreeFormTextAttribute


.. currentmodule:: dpsynth.constraints

The constraints module lets you express known relationships between columns so that the synthetic data honours them. Pass a list of :class:`~dpsynth.constraints.Constraint` objects as cross_attribute_constraints to :class:`~dpsynth.TabularConfig`.

.. autosummary::
   :toctree: _autosummary
   :nosignatures:
   :template: autosummary/class.rst

   Constraint


.. currentmodule:: dpsynth.api

These abstract base classes define the three-phase construct → calibrate → run protocol shared by all DPSynth mechanisms.

.. autosummary::
   :toctree: _autosummary
   :nosignatures:
   :template: autosummary/class.rst

   MechanismConfig
   CalibratedMechanism


.. currentmodule:: dpsynth

The primary entry point for generating differentially private synthetic data from standard tabular datasets (such as Pandas DataFrames).

.. autosummary::
   :toctree: _autosummary
   :nosignatures:
   :template: autosummary/class.rst

   TabularConfig
   TabularMechanism


.. currentmodule:: dpsynth.discrete_mechanisms

Discrete mechanisms operate on pre-discretized integer datasets (:class:`mbi.Dataset`). :class:`~dpsynth.TabularConfig` applies them internally after encoding your DataFrame. Use them directly only if you already have a discrete dataset.

Each config class corresponds to a published DP synthesis algorithm. Pass one as the discrete_mechanism argument to :class:`~dpsynth.TabularConfig`, or use :class:`~dpsynth.discrete_mechanisms.DiscreteConfig` to add one-way marginal measurement and domain compression.

.. autosummary::
   :toctree: _autosummary
   :nosignatures:
   :template: autosummary/class.rst

   AIMConfig
   MSTConfig
   IndependentConfig
   DirectConfig
   SWIFTConfig

:class:`DiscreteConfig` wraps any of the mechanism configs above with one-way marginal pre-measurement and optional domain compression. When calibrated, it produces a runnable :class:`DiscreteMechanism`. This is the recommended entry point when you have a pre-discretized table.

.. autosummary::
   :toctree: _autosummary
   :nosignatures:
   :template: autosummary/class.rst

   DiscreteConfig
   DiscreteMechanism