postprocess#

Measurements for processing the output of other measurements.

Classes#

PostProcess

Component for postprocessing the result of a measurement.

NonInteractivePostProcess

Component for postprocessing an interactive measurement as a closed interaction.

class PostProcess(measurement, f)#

Bases: tmlt.core.measurements.base.Measurement

Component for postprocessing the result of a measurement.

The privacy guarantee for PostProcess depends on the passed function f satisfying certain properties. In particular, f should not use distinguishing psuedo-side channel information, and should be well-defined on its abstract input domain. See Postprocessing udfs and pseudo-side channel information.

Parameters
__init__(measurement, f)#

Constructor.

Parameters
property f#

Returns the postprocess function.

Note

Returned function object should not be mutated.

Return type

Callable[[Any], Any]

property measurement#

Returns the measurement to be postprocessed.

Return type

tmlt.core.measurements.base.Measurement

privacy_function(d_in)#

Returns the smallest d_out satisfied by the measurement.

Returns self.measurement.privacy_relation(d_in).

Parameters

d_in (Any) – Distance between inputs under input_metric.

Raises

NotImplementedError – If self.measurement.privacy_relation(d_in) raises NotImplementedError.

Return type

Any

privacy_relation(d_in, d_out)#

Return True if close inputs produce close outputs.

Returns self.measurement.privacy_relation(d_in, d_out).

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

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

Return type

bool

__call__(data)#

Compute answer to measurement.

Parameters

data (Any) –

Return type

Any

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

class NonInteractivePostProcess(measurement, f)#

Bases: tmlt.core.measurements.base.Measurement

Component for postprocessing an interactive measurement as a closed interaction.

Any algorithm which only interacts with the Queryable from a single interactive measurement and doesn’t allow anything else to interact with it can be implemented as a NonInteractivePostProcess. This allows for algorithms to have subroutines which internally leverage interactivity

  1. while composing the subroutines using rules that require that the subroutines do not share intermediate state (rules that require that the subroutines are not themselves interactive measurements)

  2. and to not necessarily be considered interactive at the top level.

This measurement is not interactive, and must not return a queryable when run.

The privacy guarantee of NonInteractivePostProcess uses the following model for the passed udf f: f simulates the interaction between the input queryable and some pure function \(g\) (which takes as input a queryable answer, and produces the next query to be asked), the resulting transcript (the list of queries and query answers) is then passed to some pure function \(h\), and f returns the output of \(h\). We additionally assume that both \(g\) and \(h\) don’t use distinguishing pseudo-side channel information, and are thus well-defined on their abstract domains (see Postprocessing udfs and pseudo-side channel information).

Practically, the udf passed to NonInteractivePostProcess can break this model by using either distinguishing psuedo-side channel information or side-channel information. Note that while Tumult Core makes a best-effort attempt to make sure that a user can not accidentally use distinguishing psuedo-side channel information, there are no protections against the use of side channel information. This responsibility falls on the user. The udf should use only the explicit outputs of the Queryable. See Side channel information for more details.

Parameters
__init__(measurement, f)#

Constructor.

Parameters
  • measurement (MeasurementMeasurement) – Interactive measurement to be postprocessed.

  • f (CallableCallable) – Function to be applied to the queryable created by the given measurement. This function must not expose the queryable to outside code (For example, by storing it in a global data structure).

property f#

Returns the postprocess function.

Note

Returned function object should not be mutated.

Return type

Callable

property measurement#

Returns the interactive measurement to be postprocessed.

Return type

tmlt.core.measurements.base.Measurement

privacy_function(d_in)#

Returns the smallest d_out satisfied by the measurement.

Returns the output of the privacy_function() of the postprocessed measurement.

Parameters

d_in (Any) – Distance between inputs under input_metric.

Return type

Any

privacy_relation(d_in, d_out)#

Return True if close inputs produce close outputs.

Returns the output of the privacy_relation() of the postprocessed measurement.

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

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

Return type

bool

__call__(data)#

Compute answer to measurement.

Parameters

data (Any) –

Return type

Any

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