parameters#

Helper functions for selecting component parameters.

Functions#

 calculate_noise_scale() Returns the noise scale to satisfy the desired privacy guarantee.
calculate_noise_scale(d_in, d_out, output_measure)#

Returns the noise scale to satisfy the desired privacy guarantee.

Let
• $$\sigma$$ be the returned noise scale

• $$d_{in}$$ be the input argument d_in

• $$\epsilon$$ be the PureDP guarantee (d_out if output_measure is PureDP)

• $$\rho$$ be the RhoZCDP guarantee (d_out if output_measure is RhoZCDP)

Calculations for Laplace or geometric noise

formulas:

• noise mechanism privacy guarantee - $$\epsilon = \frac{d_{in}}{\sigma}$$

• pure DP to rho zCDP conversion - $$\epsilon = \sqrt{2 \rho}$$

Solving for $$\sigma$$ gives us $$\sigma = \frac{d_{in}}{\epsilon} = \frac{d_{in}}{\sqrt{2 \rho}}$$

Calculations for discrete Gaussian noise

formulas:

• noise mechanism privacy guarantee - $$\rho = \frac{d_{in}^2}{2 \sigma^2}$$

• pure DP to rho zCDP conversion - $$\epsilon = \sqrt{2 \rho}$$

Solving for $$\sigma$$ (again) gives us $$\sigma = \frac{d_{in}}{\epsilon} = \frac{d_{in}}{\sqrt{2 \rho}}$$

Note

Make sure to square the returned value if you want to use it as sigma_squared for discrete Gaussian noise.

Examples

>>> calculate_noise_scale(
...     d_in=1,
...     d_out=1,
...     output_measure=PureDP(),
... )
1
>>> calculate_noise_scale(
...     d_in=2,
...     d_out=1,
...     output_measure=PureDP(),
... )
2
>>> calculate_noise_scale(
...     d_in=1,
...     d_out=2,
...     output_measure=PureDP(),
... )
1/2
>>> calculate_noise_scale(
...     d_in=1,
...     d_out=1,
...     output_measure=RhoZCDP(),
... )
sqrt(2)/2
>>> calculate_noise_scale(
...     d_in=2,
...     d_out=1,
...     output_measure=RhoZCDP(),
... )
sqrt(2)
>>> calculate_noise_scale(
...     d_in=1,
...     d_out=2,
...     output_measure=RhoZCDP(),
... )
1/2
>>> calculate_noise_scale(
...     d_in=1,
...     d_out=0,
...     output_measure=PureDP(),
... )
oo

Parameters
• d_in (tmlt.core.utils.exact_number.ExactNumberInput) – The absolute distance between neighboring inputs.

• d_out (tmlt.core.utils.exact_number.ExactNumberInput) – The desired output measure value.

• output_measure (Union[tmlt.core.measures.PureDP, tmlt.core.measures.RhoZCDP]) – The desired privacy guarantee.

Return type

tmlt.core.utils.exact_number.ExactNumber