opendp.core module#
- opendp.core.make_basic_composition(measurement0, measurement1)[source]#
Construct the DP composition (
measurement0
,measurement1
). Returns a Measurement.- Parameters:
measurement0 (Measurement) – The left member of the resulting 2-tuple.
measurement1 (Measurement) – The right member of the resulting 2-tuple.
- Returns:
Measurement representing the composed transformations.
- Return type:
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.make_chain_mt(measurement, transformation)[source]#
Construct the functional composition (
measurement
○transformation
). Returns a Measurement.- Parameters:
measurement (Measurement) – outer privatizer
transformation (Transformation) – inner query
- Returns:
Measurement representing the chained computation.
- Return type:
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.make_chain_tt(transformation1, transformation0)[source]#
Construct the functional composition (
transformation1
○transformation0
). Returns a Tranformation.- Parameters:
transformation1 (Transformation) – outer transformation
transformation0 (Transformation) – inner transformation
- Returns:
Transformation representing the chained computation.
- Return type:
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.measurement_check(measurement, d_in, d_out)[source]#
Check the privacy relation of the
measurement
at the givend_in
,d_out
.- Parameters:
measurement (Measurement) – Measurement to check the privacy relation of.
d_in – Distance in terms of the input metric.
d_out – Distance in terms of the output measure.
- Returns:
True indicates that the relation passed at the given distance.
- Return type:
bool
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.measurement_input_carrier_type(measurement)[source]#
Get the input (carrier) data type of
measurement
.- Parameters:
measurement (Measurement) – The measurement to retrieve the type from.
- Return type:
str
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.measurement_input_distance_type(measurement)[source]#
Get the input distance type of
measurement
.- Parameters:
measurement (Measurement) – The measurement to retrieve the type from.
- Return type:
str
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.measurement_invoke(measurement, arg)[source]#
Invoke the
measurement
witharg
. Returns a differentially private release.- Parameters:
measurement (Measurement) – Measurement to invoke.
arg (Any) – Input data to supply to the measurement. A member of the measurement’s input domain.
- Returns:
Differentially private release.
- Return type:
Any
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.measurement_output_distance_type(measurement)[source]#
Get the output distance type of
measurement
.- Parameters:
measurement (Measurement) – The measurement to retrieve the type from.
- Return type:
str
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.transformation_check(transformation, d_in, d_out)[source]#
Check the stability relation of the
transformation
at the givend_in
,d_out
.- Parameters:
transformation (Transformation) – Transformation to check the stability relation of.
d_in – Distance in terms of the input metric.
d_out – Distance in terms of the output metric.
- Returns:
True indicates that the relation passed at the given distance.
- Return type:
bool
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.transformation_input_carrier_type(transformation)[source]#
Get the input (carrier) data type of
transformation
.- Parameters:
transformation (Transformation) – The transformation to retrieve the type from.
- Return type:
str
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.transformation_input_distance_type(transformation)[source]#
Get the input distance type of
transformation
.- Parameters:
transformation (Transformation) – The transformation to retrieve the type from.
- Return type:
str
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.transformation_invoke(transformation, arg)[source]#
Invoke the
transformation
witharg
. The response is not differentially private as it has not been chained with a measurement.- Parameters:
transformation (Transformation) – Transformation to invoke.
arg (Any) – Input data to supply to the measurement. A member of the transformations’s input domain.
- Returns:
Non-differentially private answer to the query.
- Return type:
Any
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library
- opendp.core.transformation_output_distance_type(transformation)[source]#
Get the output distance type of
transformation
.- Parameters:
transformation (Transformation) – The transformation to retrieve the type from.
- Return type:
str
- Raises:
AssertionError – if an argument’s type differs from the expected type
UnknownTypeError – if a type-argument fails to parse
OpenDPException – packaged error from the core OpenDP library