Questions or feedback?

Measurements#

This section gives a high-level overview of the measurements that are available in the library. Refer to the section on measurements in the discussion of core structures for a defintion of “measurement” in OpenDP.

The intermediate domains and metrics need to match when chaining. This means you will need to choose a measurement that chains with your aggregator.

Additive Noise Mechanisms#

See the Additive Noise Mechanisms notebook for code examples and more exposition.

Notice that there is a symmetric structure to the additive noise measurements:

Vector Input Metric

Constructor

L1Distance<QI>

make_laplace

L2Distance<QI>

make_gaussian

QI can be any numeric type (the data type of the sensitivity can vary independently from the data type of the input).

In the following sections, scalar-valued and vector-valued versions of each measurement are listed separately. You can choose whether to construct scalar or vector-valued versions of mechanisms by passing the appropriate input space. See the notebook above for examples.

Laplacian Noise#

These algorithms accept sensitivities in terms of the absolute or L2 metrics and measure privacy in terms of epsilon. Use the opendp.accuracy.laplacian_scale_to_accuracy() and opendp.accuracy.accuracy_to_laplacian_scale() functions to convert to/from accuracy estimates.

Measurement

Input Domain

Input Metric

Output Measure

opendp.measurements.make_laplace()

AtomDomain<T>

AbsoluteDistance<QI>

MaxDivergence

opendp.measurements.make_laplace()

VectorDomain<AtomDomain<T>>

L1Distance<QI>

MaxDivergence

Gaussian Noise#

These algorithms accept sensitivities in terms of the absolute or L2 metrics and measure privacy in terms of rho (zero-concentrated differential privacy). Use the opendp.accuracy.gaussian_scale_to_accuracy() and opendp.accuracy.accuracy_to_gaussian_scale() functions to convert to/from accuracy estimates. Refer to Measure Casting to convert to approximate DP.

Measurement

Input Domain

Input Metric

Output Measure

opendp.measurements.make_gaussian()

AtomDomain<T>

AbsoluteDistance<QI>

ZeroConcentratedDivergence

opendp.measurements.make_gaussian()

VectorDomain<AtomDomain<T>>

L2Distance<QI>

ZeroConcentratedDivergence

Geometric Noise#

The geometric mechanism (make_geometric) is an alias for the discrete Laplace (make_laplace). If you need constant-time execution to protect against timing side-channels, specify bounds!

Canonical Noise#

The canonical noise mechanism (opendp.measurements.make_canonical_noise()) is discussed in detail in these examples

Thresholded Noise Mechanisms#

Thresholded noise mechanisms are generalizations of the additive noise mechanisms that also release a set of keys, whose values are greater than the threshold parameter.

See the Thresholded Noise Mechanisms documentation for code examples and more exposition.

Just like the additive noise mechanisms, the thresholded noise mechanisms have a symmetric structure:

Vector Input Metric

Constructor

L01InfDistance<AbsoluteDistance<T>>

make_laplace_threshold

L02InfDistance<AbsoluteDistance<T>>

make_gaussian_threshold

Laplacian Noise#

The algorithm accepts L0, L1 and L∞ sensitivities and measures privacy in terms of epsilon and delta. Use the opendp.accuracy.laplacian_scale_to_accuracy() and opendp.accuracy.accuracy_to_laplacian_scale() functions to convert to/from accuracy estimates.

Measurement

Input Domain

Input Metric

Output Measure

opendp.measurements.make_laplace_threshold()

MapDomain<AtomDomain<TK>, AtomDomain<TV>>

L01InfDistance<AbsoluteDistance<QI>>

Approximate<MaxDivergence>

Gaussian Noise#

The algorithm accepts L0, L2 and L∞ sensitivities and measures privacy in terms of rho and delta. Use the opendp.accuracy.gaussian_scale_to_accuracy() and opendp.accuracy.accuracy_to_gaussian_scale() functions to convert to/from accuracy estimates. Refer to Measure Casting to convert to approximate DP.

Measurement

Input Domain

Input Metric

Output Measure

opendp.measurements.make_gaussian_threshold()

MapDomain<AtomDomain<TK>, AtomDomain<TV>>

L02InfDistance<AbsoluteDistance<QI>>

Approximate<ZeroConcentratedDivergence>

Approximate Laplace Projection#

In a similar regime as the thresholded noise mechanism, where keys themselves need to be protected, another approach is to release a differentially private low-dimensional projection of the key-space.

See Approximate Laplace Projection for a demonstration of the approach.

Measurement

Input Domain

Input Metric

Output Measure

opendp.measurements.make_alp_queryable()

MapDomain<AtomDomain<TK>, AtomDomain<TV>>

L01InfDistance<AbsoluteDistance<QI>>

MaxDivergence

Noisy Max and Noisy Top K#

See Noisy Max Mechanisms for code examples and more exposition.

The report noisy top-k mechanism is used to privately release the indices of the maximum k values in a vector. This is useful for private selection, and overlaps with the exponential mechanism. Exponential noise is added to scores when the output measure is MaxDivergence, and Gumbel noise is added when the output measure is ZeroConcentratedDivergence.

Measurement

Input Domain

Input Metric

Output Measure

opendp.measurements.make_noisy_top_k()

VectorDomain<AtomDomain<T>>

LInfDistance<T>

MaxDivergence or ZeroConcentratedDivergence

opendp.measurements.make_noisy_max()

VectorDomain<AtomDomain<T>>

LInfDistance<T>

MaxDivergence or ZeroConcentratedDivergence

Report noisy max is a special case of noisy top k when k equals one.

Randomized Response#

These measurements are used to randomize an individual’s response to a query in the local-DP model.

See Randomized Response for code examples and more exposition.

Measurement

Input Domain

Input Metric

Output Measure

opendp.measurements.make_randomized_response_bool()

AtomDomain<bool>

DiscreteDistance

MaxDivergence

opendp.measurements.make_randomized_response()

AtomDomain<T>

DiscreteDistance

MaxDivergence

opendp.measurements.make_randomized_response_bitvec()

AtomDomain<T>

DiscreteDistance

MaxDivergence