opendp.measures module#
The measures
module provides functions that measure the distance between probability distributions.
For more context, see measures in the User Guide.
For convenience, all the functions of this module are also available from opendp.prelude
.
We suggest importing under the conventional name dp
:
>>> import opendp.prelude as dp
- opendp.measures.fixed_smoothed_max_divergence(T)[source]#
Construct an instance of the
FixedSmoothedMaxDivergence
measure.fixed_smoothed_max_divergence in Rust documentation.
- Parameters:
T (Type Argument) –
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.measures.max_divergence(T)[source]#
Construct an instance of the
MaxDivergence
measure.max_divergence in Rust documentation.
- Parameters:
T (Type Argument) –
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.measures.measure_debug(this)[source]#
Debug a
measure
.- Parameters:
this (Measure) – The measure to debug (stringify).
- Return type:
str
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.measures.measure_distance_type(this)[source]#
Get the distance type of a
measure
.- Parameters:
this (Measure) – The measure to retrieve the distance type from.
- Return type:
str
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.measures.measure_type(this)[source]#
Get the type of a
measure
.- Parameters:
this (Measure) – The measure to retrieve the type from.
- Return type:
str
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.measures.smoothed_max_divergence(T)[source]#
Construct an instance of the
SmoothedMaxDivergence
measure.smoothed_max_divergence in Rust documentation.
- Parameters:
T (Type Argument) –
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.measures.user_divergence(descriptor)[source]#
Construct a new UserDivergence. Any two instances of an UserDivergence are equal if their string descriptors are equal.
- Parameters:
descriptor (str) – A string description of the privacy measure.
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.measures.zero_concentrated_divergence(T)[source]#
Construct an instance of the
ZeroConcentratedDivergence
measure.zero_concentrated_divergence in Rust documentation.
- Parameters:
T (Type Argument) –
- Return type:
- Raises:
TypeError – if an argument’s type differs from the expected type
UnknownTypeException – if a type argument fails to parse
OpenDPException – packaged error from the core OpenDP library