-
-
Notifications
You must be signed in to change notification settings - Fork 78
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
(WIP) Support to PLD composition #259 #405
base: main
Are you sure you want to change the base?
(WIP) Support to PLD composition #259 #405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! It looks good. I left some comments.
Please add tests for apply_laplace/gaussian with std_deviation (no need to add tests for all function count/sum etc), because after the next refactoring they will be removed
@@ -103,50 +104,70 @@ def compute_sigma(eps: float, delta: float, l2_sensitivity: float): | |||
delta: The delta value. | |||
l2_sensitivity: The L2 sensitivity. | |||
""" | |||
# TODO: use named arguments, when argument names are added in PyDP on PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this TODO
mechanism = dp_mechanisms.LaplaceMechanism(epsilon=eps, | ||
sensitivity=l1_sensitivity) | ||
if noise_standard_deviation is not None: | ||
mechanism = dp_mechanisms.LaplaceMechanism(epsilon=1 / |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add comment that here workaround is used, since we can't set the Laplace parameter directly
mechanism = MechanismSpec(MechanismType.LAPLACE) | ||
print(mechanism.noise_standard_deviation()) | ||
mechanism = MechanismSpec(MechanismType.LAPLACE) | ||
self.assertEqual(None, mechanism.noise_standard_deviation) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: self.assertNone(
count_noise_standard_deviation = \ | ||
sum_noise_standard_deviation = \ | ||
2*dp_params.noise_standard_deviation \ | ||
if dp_params.noise_standard_deviation is not None \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: maybe something like that
noise_std = None
if dp_params.noise_standard_deviation is not None:
noise_std = 2*dp_params.noise_standard_deviation
count_noise_standard_deviation = sum_noise_standard_deviation = noise_std
return mechanism.add_noise(1.0 * value) | ||
|
||
|
||
def _add_random_noise( | ||
value: float, | ||
eps: float, | ||
delta: float, | ||
noise_standard_deviation: float, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional[float]?
Description
Solving "Advance composition in PipelineDP" #259
The approach I'm using is:
Tasks:
Additionally:
dp_computations.py
and formatting.request_budget
receivesnoise_standard_deviation
, do you know why? not sure if it is needed, asnoise_standard_deviation
is only calculated in compute_budgets.