This documentation is for an old version of OpenDP.

The current release of OpenDP is v0.11.1.

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:

Measurement

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 (measurementtransformation). Returns a Measurement.

Parameters:
Returns:

Measurement representing the chained computation.

Return type:

Measurement

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 (transformation1transformation0). Returns a Tranformation.

Parameters:
Returns:

Transformation representing the chained computation.

Return type:

Transformation

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 given d_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 with arg. 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 given d_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 with arg. 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