ApproxDPBudget#

from tmlt.analytics import ApproxDPBudget
class tmlt.analytics.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.

property value: Tuple[ExactNumber, ExactNumber]#

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.

property epsilon: int | float#

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: int | float#

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.

property is_infinite: bool#

Returns true if epsilon is float(‘inf’) or delta is 1.

__repr__()#

Returns the string representation of this ApproxDPBudget.

Return type:

str

__eq__(other)#

Returns True if both ApproxDPBudgets are infinite or have equal values.

Return type:

bool

__hash__()#

Hashes on the values, but infinite budgets hash to the same value.

__truediv__(other)#

Divide this budget by a finite integer/float value > 0.

Return type:

ApproxDPBudget

__mul__(other)#

Multiply this budget by a finite integer/float value >= 0.

Return type:

ApproxDPBudget

__add__(other)#

Add this budget to another ApproxDPBudget or a PureDPBudget.

The resulting epsilon must greater than zero. If the resulting delta is >1 it will be rounded down to 1.

Addition is performed using basic composition, and the sum is therefore a (possibly loose) upper bound on the privacy loss from running two queries.

Return type:

ApproxDPBudget

__sub__(other)#

Subtract a PureDPBudget or ApproxDPBudget from this budget.

The resulting epsilon greater than zero, and the resulting delta must be in [0, 1]. Subtracting anything from an infinite budget will return an infinite budget.

Note that you can subtract a PureDPBudget from an ApproxDPBudget, though the reverse is not allowed.

Return type:

ApproxDPBudget

classmethod inf()#

Get an infinite budget of this type.

Return type:

ApproxDPBudget