opendp.combinators module#

opendp.combinators.make_basic_composition(measurements)[source]#

Construct the DP composition [measurement0, measurement1, …]. Returns a Measurement that when invoked, computes [measurement0(x), measurement1(x), ...]

All metrics and domains must be equivalent, except for the output domain.

make_basic_composition in Rust documentation.

Parameters:

measurements (Any) – A vector of Measurements to compose.

Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_chain_mt(measurement1, transformation0)[source]#

Construct the functional composition (measurement1transformation0). Returns a Measurement that when invoked, computes measurement1(transformation0(x)).

make_chain_mt in Rust documentation.

Parameters:
Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_chain_tm(transformation1, measurement0)[source]#

Construct the functional composition (transformation1measurement0). Returns a Measurement that when invoked, computes transformation1(measurement0(x)). Used to represent non-interactive postprocessing.

make_chain_tm in Rust documentation.

Parameters:
  • transformation1 (Transformation) – outer postprocessing transformation

  • measurement0 (Measurement) – inner measurement/mechanism

Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_chain_tt(transformation1, transformation0)[source]#

Construct the functional composition (transformation1transformation0). Returns a Transformation that when invoked, computes transformation1(transformation0(x)).

make_chain_tt in Rust documentation.

Parameters:
Return type:

Transformation

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_default_user_measurement(function, privacy_map, DI, DO, MI, MO)[source]#

Construct a Measurement from user-defined callbacks.

Supported Domains:

  • VectorDomain<AllDomain<_>>

  • AllDomain<_>

Supported Metrics:

  • SymmetricDistance

  • InsertDeleteDistance

  • ChangeOneDistance

  • HammingDistance

  • DiscreteDistance

  • AbsoluteDistance<_>

  • L1Distance<_>

  • L2Distance<_>

Supported Measures:

  • MaxDivergence<_>

  • FixedSmoothedMaxDivergence<_>

  • ZeroConcentratedDivergence<_>

make_default_user_measurement in Rust documentation.

Parameters:
  • function – A function mapping data from DI to DO.

  • privacy_map – A function mapping distances from MI to MO.

  • DI (Type Argument) – Input Domain. See Supported Domains

  • DO (Type Argument) – Output Domain. See Supported Domains

  • MI (Type Argument) – Input Metric. See Supported Metrics

  • MO (Type Argument) – Output Measure. See Supported Measures

Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_default_user_postprocessor(function, DI, DO)[source]#

Construct a Postprocessor from user-defined callbacks.

Supported Domains:

  • VectorDomain<AllDomain<_>>

  • AllDomain<_>

make_default_user_postprocessor in Rust documentation.

Parameters:
  • function – A function mapping data from DI to DO.

  • DI (Type Argument) – Input Domain. See Supported Domains

  • DO (Type Argument) – Output Domain. See Supported Domains

Return type:

Transformation

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_default_user_transformation(function, stability_map, DI, DO, MI, MO)[source]#

Construct a Transformation from user-defined callbacks.

Supported Domains:

  • VectorDomain<AllDomain<_>>

  • AllDomain<_>

Supported Metrics:

  • SymmetricDistance

  • InsertDeleteDistance

  • ChangeOneDistance

  • HammingDistance

  • DiscreteDistance

  • AbsoluteDistance<_>

  • L1Distance<_>

  • L2Distance<_>

make_default_user_transformation in Rust documentation.

Parameters:
  • function – A function mapping data from DI to DO.

  • stability_map – A function mapping distances from MI to MO.

  • DI (Type Argument) – Input Domain. See Supported Domains

  • DO (Type Argument) – Output Domain. See Supported Domains

  • MI (Type Argument) – Input Metric. See Supported Metrics

  • MO (Type Argument) – Output Metric. See Supported Metrics

Return type:

Transformation

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_fix_delta(measurement, delta)[source]#

Fix the delta parameter in the privacy map of a measurement with a SmoothedMaxDivergence output measure.

make_fix_delta in Rust documentation.

Parameters:
  • measurement (Measurement) – a measurement with a privacy curve to be fixed

  • delta (Any) – parameter to fix the privacy curve with

Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_population_amplification(measurement, population_size)[source]#

Construct an amplified measurement from a measurement with privacy amplification by subsampling. This measurement does not perform any sampling. It is useful when you have a dataset on-hand that is a simple random sample from a larger population.

The DIA, DO, MI and MO between the input measurement and amplified output measurement all match.

Protected by the “honest-but-curious” feature flag because a dishonest adversary could set the population size to be arbitrarily large.

make_population_amplification in Rust documentation.

Parameters:
  • measurement (Measurement) – the computation to amplify

  • population_size (int) – the size of the population from which the input dataset is a simple sample

Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_pureDP_to_fixed_approxDP(measurement)[source]#

Constructs a new output measurement where the output measure is casted from MaxDivergence<QO> to FixedSmoothedMaxDivergence<QO>.

make_pureDP_to_fixed_approxDP in Rust documentation.

Parameters:

measurement (Measurement) – a measurement with a privacy measure to be casted

Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_pureDP_to_zCDP(measurement)[source]#

Constructs a new output measurement where the output measure is casted from MaxDivergence<QO> to ZeroConcentratedDivergence<QO>.

make_pureDP_to_zCDP in Rust documentation.

Citations:

Parameters:

measurement (Measurement) – a measurement with a privacy measure to be casted

Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library

opendp.combinators.make_zCDP_to_approxDP(measurement)[source]#

Constructs a new output measurement where the output measure is casted from ZeroConcentratedDivergence<QO> to SmoothedMaxDivergence<QO>.

make_zCDP_to_approxDP in Rust documentation.

Parameters:

measurement (Measurement) – a measurement with a privacy measure to be casted

Return type:

Measurement

Raises:
  • TypeError – if an argument’s type differs from the expected type

  • UnknownTypeError – if a type argument fails to parse

  • OpenDPException – packaged error from the core OpenDP library