opendp.accuracy module#

opendp.accuracy.accuracy_to_gaussian_scale(accuracy, alpha, T=None)[source]#

Convert a desired accuracy into a gaussian noise scale.

Parameters:
  • accuracy – Desired accuracy.

  • alpha – Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1).

  • T (RuntimeTypeDescriptor) – Data type of accuracy and alpha

Returns:

Gaussian noise scale that meets the accuracy requirement at a level-alpha.

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.accuracy.accuracy_to_laplacian_scale(accuracy, alpha, T=None)[source]#

Convert a desired accuracy into a laplacian noise scale.

Parameters:
  • accuracy – Desired accuracy.

  • alpha – Statistical significance, level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1).

  • T (RuntimeTypeDescriptor) – Data type of accuracy and alpha

Returns:

Laplacian noise scale that meets the accuracy requirement at a level-alpha.

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.accuracy.gaussian_scale_to_accuracy(scale, alpha, T=None)[source]#

Convert a gaussian scale into an accuracy estimate.

Parameters:
  • scale – Gaussian noise scale.

  • alpha – Level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

  • T (RuntimeTypeDescriptor) – Data type of scale and alpha

Returns:

Accuracy estimate at a level-alpha.

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.accuracy.laplacian_scale_to_accuracy(scale, alpha, T=None)[source]#

Convert a laplacian scale into an accuracy estimate.

Parameters:
  • scale – Laplacian noise scale.

  • alpha – Level-alpha, or (1. - alpha)100% confidence. Must be within (0, 1].

  • T (RuntimeTypeDescriptor) – Data type of scale and alpha

Returns:

Accuracy estimate at a level-alpha.

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