privacy_budget#
Classes for specifying privacy budgets.
For a full introduction to privacy budgets, see the privacy budget topic guide.
Classes#
Base class for specifying privacy parameters. 

A privacy budget under pure differential privacy. 

A privacy budget under approximate differential privacy. 

A privacy budget under rhozeroconcentrated differential privacy. 
 class PrivacyBudget#
Bases:
abc.ABC
Base class for specifying privacy parameters.
A PrivacyBudget is a privacy definition, along with its associated parameters. The choice of a PrivacyBudget has an impact on the accuracy of query results. Smaller parameters correspond to a stronger privacy guarantee, and usually lead to less accurate results.
Note
An “infinite” privacy budget means that the chosen DP algorithm will use parameters that do not guarantee privacy. This is not always exactly equivalent to evaluating the query without applying differential privacy. Please see the individual subclasses of PrivacyBudget for details on how to appropriately specify infinite budgets.
 property value#
Return the value of the privacy budget.
 Return type
Union[tmlt.core.utils.exact_number.ExactNumber, Tuple[tmlt.core.utils.exact_number.ExactNumber, tmlt.core.utils.exact_number.ExactNumber]]
 class PureDPBudget(epsilon)#
Bases:
PrivacyBudget
A privacy budget under pure differential privacy.
This privacy definition is also known as epsilondifferential privacy, and the associated value is the epsilon privacy parameter. The privacy definition can be found here.
 __init__(epsilon)#
Construct a new PureDPBudget.
 property value#
Return the value of the privacy budget as an ExactNumber.
For printing purposes, you should use the epsilon property instead, as it will represent the same value, but be more human readable.
 Return type
tmlt.core.utils.exact_number.ExactNumber
 property epsilon#
Returns the value of epsilon as an int or float.
This is helpful for human readability. If you need to use the epsilon value in a computation, you should use self.value instead.
 class ApproxDPBudget(epsilon, delta)#
Bases:
PrivacyBudget
A privacy budget under approximate differential privacy.
This privacy definition is also known as (ε, δ)differential privacy, and the associated privacy parameters are epsilon and delta. The formal definition can be found here.
 Parameters
 __init__(epsilon, delta)#
Construct a new ApproxDPBudget.
 Parameters
epsilon (
int
float
ExactNumber
Union
[int
,float
,ExactNumber
]) – The epsilon privacy parameter. Must be nonnegative. To specify an infinite budget, set epsilon equal to float(‘inf’).delta (
int
float
ExactNumber
Union
[int
,float
,ExactNumber
]) – The delta privacy parameter. Must be between 0 and 1 (inclusive). If delta is 0, this is equivalent to PureDP.
 property value#
Returns self._epsilon and self._delta as an ExactNumber tuple.
For printing purposes, you might want to use the epsilon and delta properties instead, as they will represent the same values, but be more human readable.
 Return type
Tuple[tmlt.core.utils.exact_number.ExactNumber, tmlt.core.utils.exact_number.ExactNumber]
 property epsilon#
Returns the value of epsilon as an int or float.
This is helpful for human readability. If you need to use the epsilon value in a computation, you should use self.value[0] instead.
 property delta#
Returns the value of delta as an int or float.
This is helpful for human readability. If you need to use the delta value in a computation, you should use self.value[1] instead.
 __eq__(other)#
Returns whether an ApproxDPBudget is equivalent to another privacy budget.
ApproxDPBudgets that have delta of 0 are considered equal to PureDPBudgets with the same epsilon. ApproxDPBudgets that provide no privacy guarantee are considered equal (for example, if one has an epsilon of float(‘inf’) and the other has a delta of 1).
 Return type
 class RhoZCDPBudget(rho)#
Bases:
PrivacyBudget
A privacy budget under rhozeroconcentrated differential privacy.
The definition of rhozCDP can be found in this paper under Definition 1.1.
 __init__(rho)#
Construct a new RhoZCDPBudget.
 property value#
Return the value of the privacy budget as an ExactNumber.
For printing purposes, you should use the rho property instead, as it will represent the same value, but be more human readable.
 Return type
tmlt.core.utils.exact_number.ExactNumber
 property rho#
Returns the value of rho as an int or float.
This is helpful for human readability. If you need to use the rho value in a computation, you should use self.value instead.