opendp.accuracy module#

The accuracy module provides functions for converting between accuracy and scale parameters.

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

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

accuracy_to_discrete_gaussian_scale in Rust documentation.

Proof Definition:

(Proof Document)

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 (Type Argument) – Data type of accuracy and alpha

Return type:

Any

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

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

accuracy_to_discrete_laplacian_scale in Rust documentation.

Proof Definition:

(Proof Document)

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 (Type Argument) – Data type of accuracy and alpha

Returns:

Discrete laplacian noise scale that meets the accuracy requirement at a given level-alpha.

Return type:

Any

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.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.

accuracy_to_gaussian_scale in Rust documentation.

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 (Type Argument) – Data type of accuracy and alpha

Return type:

Any

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.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.

accuracy_to_laplacian_scale in Rust documentation.

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 (Type Argument) – Data type of accuracy and alpha

Returns:

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

Return type:

Any

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

Convert a discrete gaussian scale into an accuracy estimate (tolerance) at a statistical significance level alpha.

discrete_gaussian_scale_to_accuracy in Rust documentation.

Proof Definition:

(Proof Document)

Parameters:
  • scale – Gaussian noise scale.

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

  • T (Type Argument) – Data type of scale and alpha

Return type:

Any

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

Convert a discrete Laplacian scale into an accuracy estimate (tolerance) at a statistical significance level alpha.

\(\alpha = P[Y \ge accuracy]\), where \(Y = | X - z |\), and \(X \sim \mathcal{L}_{Z}(0, scale)\). That is, \(X\) is a discrete Laplace random variable and \(Y\) is the distribution of the errors.

This function returns a float accuracy. You can take the floor without affecting the coverage probability.

discrete_laplacian_scale_to_accuracy in Rust documentation.

Proof Definition:

(Proof Document)

Parameters:
  • scale – Discrete Laplacian noise scale.

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

  • T (Type Argument) – Data type of scale and alpha

Return type:

Any

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.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.

gaussian_scale_to_accuracy in Rust documentation.

Parameters:
  • scale – Gaussian noise scale.

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

  • T (Type Argument) – Data type of scale and alpha

Return type:

Any

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.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.

laplacian_scale_to_accuracy in Rust documentation.

Parameters:
  • scale – Laplacian noise scale.

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

  • T (Type Argument) – Data type of scale and alpha

Return type:

Any

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