Skip to content

Commit

Permalink
Use tight Gaussian noise (#114)
Browse files Browse the repository at this point in the history
* Use tight Gaussian noise

* Use tight Gaussian noise

* Restore scipy requirement

Co-authored-by: Pasin Manurangsi <[email protected]>
  • Loading branch information
pasin30055 and Pasin Manurangsi authored Nov 17, 2020
1 parent a755c61 commit efbc524
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ scipy==1.2.1
seaborn==0.9.0
tqdm==4.47.0
lxml==4.5.2
dp-accounting==0.0.1
9 changes: 5 additions & 4 deletions src/common/noisers.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

import math
import numpy as np
from dp_accounting import accountant
from dp_accounting import common


class LaplaceMechanism:
Expand Down Expand Up @@ -142,10 +144,9 @@ def __init__(
"""
self._func = f
self._delta_f = delta_f
# TODO(pasin30055): Use tight computation of sigma.
# Set the standard deviation sigma, following Appendix A of Dwork and Roth.
self._sigma = (math.sqrt(2 * math.log(1.25 / delta)) * delta_f *
math.sqrt(num_queries) / epsilon)
self._sigma = accountant.get_smallest_gaussian_noise(
common.DifferentialPrivacyParameters(epsilon, delta),
num_queries, sensitivity=delta_f)
self._random_state = random_state or np.random.RandomState()

def __call__(self, x):
Expand Down

0 comments on commit efbc524

Please sign in to comment.