opendp.accuracy module#

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

Convert a desired accuracy (tolerance) into a gaussian noise scale at a statistical significance level alpha.

Parameters:
  • accuracy – Desired accuracy. A tolerance for how far values may diverge from the input to the mechanism.

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

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

Returns:

Gaussian noise scale that meets the accuracy requirement at a given 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 (tolerance) into a laplacian noise scale at a statistical significance level alpha.

Parameters:
  • accuracy – Desired accuracy. A tolerance for how far values may diverge from the input to the mechanism.

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

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

Returns:

Laplacian noise scale that meets the accuracy requirement at a given 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 (tolerance) at a statistical significance level alpha.

Parameters:
  • scale – Gaussian noise scale.

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

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

Returns:

Accuracy estimate. Maximum amount a value is expected to diverge at the given 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 (tolerance) at a statistical significance level alpha.

Parameters:
  • scale – Laplacian noise scale.

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

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

Returns:

Accuracy estimate. Maximum amount a value is expected to diverge at the given 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