Measurement Constructors#

This section gives a high-level overview of the measurements that are available in the library. Refer to the Measurement section for an explanation of what a measurement is.

As covered in the Chaining section, the intermediate domains and metrics need to match when chaining. This means you will need to choose a measurement that chains with your aggregator.

In the following table, the scalar-valued and vector-valued versions of each measurement are listed separately. You can choose whether to construct scalar or vector-valued versions by setting the D type argument when calling the constructor.

Scalar:

D=AllDomain[T] (default)

Vector:

D=VectorDomain[AllDomain[T]]

Measurement

Input Domain

Output Metric

Output Measure

opendp.meas.make_base_geometric()

AllDomain<T>

AbsoluteDistance<T>

MaxDivergence<T>

opendp.meas.make_base_geometric()

VectorDomain<AllDomain<T>>

L1Distance<T>

MaxDivergence<T>

opendp.meas.make_base_laplace()

AllDomain<T>

AbsoluteDistance<T>

MaxDivergence<T>

opendp.meas.make_base_laplace()

VectorDomain<AllDomain<T>>

L1Distance<T>

MaxDivergence<T>

opendp.meas.make_base_gaussian()

AllDomain<T>

AbsoluteDistance<T>

SmoothedMaxDivergence<T>

opendp.meas.make_base_gaussian()

VectorDomain<AllDomain<T>>

L2Distance<T>

SmoothedMaxDivergence<T>

opendp.meas.make_base_stability()

SizedDomain<MapDomain<AllDomain<TIA>, AllDomain<TOA>>>

L1Distance<T> or L2Distance<T>

SmoothedMaxDivergence<T>

Floating-Point#

Given the context of measurements, this section goes into greater detail than Limitations on floating-point issues. Be warned that opendp.meas.make_base_laplace(), opendp.meas.make_base_gaussian() and opendp.meas.make_base_stability() depend on continuous distributions that are poorly approximated by finite computers.

At this time these mechanisms are present in the library, but require explicit opt-in:

>>> from opendp.mod import enable_features
>>> enable_features("floating-point")

The canonical paper on this and introduction of the snapping mechanism is here: On Significance of the Least Significant Bits For Differential Privacy.

Precautions have been made to sample noise using the MPFR library, to avoid artifacts in noise, but our noise postprocessing re-introduces artifacts. We are developing alternative mechanisms for answering continuous queries.

We acknowledge the snapping mechanism and have an implementation of it in PR #84.

We are also working towards adding support for fixed-point data types in PR #184.