composition#

Measurement for combining multiple measurements into a single measurement.

Classes#

Composition

Describes a measurement constructed by composing two or more Measurements.

class Composition(measurements, hint=None)#

Bases: tmlt.core.measurements.base.Measurement

Describes a measurement constructed by composing two or more Measurements.

Parameters
__init__(measurements, hint=None)#

Constructor.

It supports PureDP, ApproxDP, and RhoZCDP. Input metrics, domains, and output measures must be identical across all supplied measurements.

Parameters
property measurements#

Returns the list of measurements being composed.

Return type

List[tmlt.core.measurements.base.Measurement]

privacy_function(d_in)#

Returns the smallest d_out satisfied by the measurement.

Returns the sum of the privacy_function()’s of the composed measurements on d_in (adding element-wise for ApproxDP).

Parameters

d_in (Any) – Distance between inputs under input_metric.

Raises

NotImplementedError – If the privacy_function() of one of the composed measurements raises NotImplementedError.

Return type

Any

privacy_relation(d_in, d_out)#

Returns True only if outputs are close under close inputs.

Let d_outs be the d_out from the privacy_function()’s of all measurements or the d_outs from the hint if one of them raises NotImplementedError.

And total_d_out to be the sum of d_outs (adding element-wise for ApproxDP ).

This returns True if total_d_out <= d_out (the input argument) and each composed measurement satisfies its privacy_relation() from d_in to its d_out from d_outs.

Parameters
  • d_in (Any) – Distance between inputs under input_metric.

  • d_out (Any) – Distance between outputs under output_measure.

Raises

ValueError – If a hint is not provided and the privacy_function() of one of the composed measurements raises NotImplementedError.

Return type

bool

__call__(data)#

Return answers to composed measurements.

Parameters

data (Any) –

Return type

List

property input_domain#

Return input domain for the measurement.

Return type

tmlt.core.domains.base.Domain

property input_metric#

Distance metric on input domain.

Return type

tmlt.core.metrics.Metric

property output_measure#

Distance measure on output.

Return type

tmlt.core.measures.Measure

property is_interactive#

Returns true iff the measurement is interactive.

Return type

bool