distributions#

Probability functions for distributions commonly used in differential privacy.

Functions#

double_sided_geometric_pmf()

Returns the pmf for a double-sided geometric distribution at k.

double_sided_geometric_cmf()

Returns the cmf for a double-sided geometric distribution at k.

double_sided_geometric_cmf_exact()

Returns exact value of the cmf for a double-sided geometric distribution at k.

discrete_gaussian_pmf()

Returns the pmf for a discrete gaussian distribution at k.

discrete_gaussian_cmf()

Returns the cmf for a discrete gaussian distribution at k.

double_sided_geometric_pmf(k: int, alpha: float) float#
double_sided_geometric_pmf(k: numpy.ndarray, alpha: float) numpy.ndarray

Returns the pmf for a double-sided geometric distribution at k.

For \(k \in \mathbb{Z}\)

\[f(k)= \frac {e^{1 / \alpha} - 1} {e^{1 / \alpha} + 1} \cdot e^{\frac{-\mid k \mid}{\alpha}}\]

A double sided geometric distribution is the difference between two geometric distributions (It can be sampled by sampling two values from a geometric distribution, and taking their difference).

See section 4.1 in [BV18] or scipy.stats.geom for more information (Note that the parameter \(p\) used in scipy.stats.geom is related to \(\alpha\) through \(p = 1 - e^{-1 / \alpha}\)).

Parameters
  • k – The values to calculate the pmf for.

  • alpha – The scale of the geometric distribution.

double_sided_geometric_cmf(k: int, alpha: float) float#
double_sided_geometric_cmf(k: numpy.ndarray, alpha: float) numpy.ndarray

Returns the cmf for a double-sided geometric distribution at k.

For \(k \in \mathbb{Z}\)

\[\begin{split}F(k) = \begin{cases} \frac{e^{1 / \alpha}}{e^{1 / \alpha} + 1} \cdot e^\frac{k}{\alpha} & \text{if k} \le 0 \\ 1 - \frac{1}{e^{1 / \alpha} + 1}\cdot e^{\frac{-k}{\alpha}} & \text{otherwise} \\ \end{cases}\end{split}\]

See double_sided_geometric_pmf() for more information.

Parameters
  • k – The values to calculate the pmf for.

  • alpha – The scale of the geometric distribution.

double_sided_geometric_cmf_exact(k, alpha)#

Returns exact value of the cmf for a double-sided geometric distribution at k.

See double_sided_geometric_cmf() for more information.

Parameters
  • k (tmlt.core.utils.exact_number.ExactNumberInput) – The values to calculate the pmf for.

  • alpha (tmlt.core.utils.exact_number.ExactNumberInput) – The scale of the geometric distribution.

Return type

tmlt.core.utils.exact_number.ExactNumber

discrete_gaussian_pmf(k: int, sigma_squared: float) float#
discrete_gaussian_pmf(k: numpy.ndarray, sigma_squared: float) numpy.ndarray

Returns the pmf for a discrete gaussian distribution at k.

For \(k \in \mathbb{Z}\)

(1)#\[f(k) = \frac {e^{-k^2/2\sigma^2}} { \sum_{n\in \mathbb{Z}} e^{-n^2/2\sigma^2} }\]

See [CKS20] for more information. The formula above is based on Definition 1.

The implementation also referenced the paper’s implementation, which can be found at https://github.com/IBM/discrete-gaussian-differential-privacy.

discrete_gaussian_cmf(k: int, sigma_squared: float) float#
discrete_gaussian_cmf(k: numpy.ndarray, sigma_squared: float) numpy.ndarray

Returns the cmf for a discrete gaussian distribution at k.

See (1) for the probability mass function.