_privacy_budget_rounding_helper#
Helper functions for dealing with budget floating point imprecision.
Functions#
Returns True if requested budget is slightly larger than remaining. |
|
Converts a requested int or float budget into an adjusted budget. |
|
Converts a requested privacy budget into an adjusted privacy budget. |
|
Creates a privacy budget with infinite epsilon/rho and 0 delta. |
- 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
- get_adjusted_budget_number(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.
- Parameters
requested_budget (tmlt.core.utils.exact_number.ExactNumber) – The numeric value of the requested budget.
remaining_budget (tmlt.core.utils.exact_number.ExactNumber) – The numeric value of how much budget we have left.
- Return type
tmlt.core.utils.exact_number.ExactNumber
- get_adjusted_budget(requested_privacy_budget, remaining_privacy_budget)#
Converts a requested privacy budget into an adjusted privacy budget.
For each term in the privacy budget, calls get_adjusted_budget_number to adjust the requested budget slightly if it’s close enough to the remaining budget.
- Parameters
requested_privacy_budget (tmlt.analytics.privacy_budget.PrivacyBudget) – The requested privacy budget.
remaining_privacy_budget (tmlt.analytics.privacy_budget.PrivacyBudget) – How much privacy budget we have left.
- Return type
- get_infinite_budget(privacy_budget)#
Creates a privacy budget with infinite epsilon/rho and 0 delta.
- Parameters
privacy_budget (tmlt.analytics.privacy_budget.PrivacyBudget) – The privacy budget to use as a template.
- Return type