_privacy_budget_rounding_helper#
Helper functions for dealing with budget floating point imprecision.
Functions#
Converts a requested int or float budget into an adjusted budget. |
|
Returns True if requested budget is slightly larger than remaining. |
- get_adjusted_budget(requested_budget, remaining_budget)#
Converts a requested int or float budget into an adjusted budget.
If the requested budget is “slightly larger” than the remaining budget, as determined by some threshold, then we round down and consume all remaining budget. The goal is to accommodate some degree of floating point imprecision by erring on the side of providing a slightly stronger privacy guarantee rather than declining the request altogether.
- requested_budget_is_slightly_higher_than_remaining(requested_budget, remaining_budget)#
Returns True if requested budget is slightly larger than remaining.
This check uses a relative tolerance, i.e., it determines if the requested budget is within X% of the remaining budget.
- Parameters
requested_budget (tmlt.core.utils.exact_number.ExactNumber) – Exact representation of requested budget.
remaining_budget (tmlt.core.utils.exact_number.ExactNumber) – Exact representation of how much budget we have left.
- Return type