OpenMined / PyDP

The Python Differential Privacy Library. Built on top of: https://github.com/google/differential-privacy
Apache License 2.0
497 stars 136 forks source link

In "restaurant_demo" notebook, BoundedSum(epsilon, MIN_EUROS_SPENT, MAX_EUROS_SPENT, 4) does not work #410

Closed lmaxeniro closed 2 years ago

lmaxeniro commented 2 years ago

Description

In "restaurant_demo" notebook, BoundedSum(epsilon, MIN_EUROS_SPENT, MAX_EUROS_SPENT, 4) does not work

How to Reproduce

run the notebook line by line, up to "Both Private and Non-private values" section runtime error report: `


RuntimeError Traceback (most recent call last) /tmp/ipykernel_26944/2545274799.py in 15 amount_bounded.append(amount) 16 ---> 17 total = private_per_day_amount_bounded(amount_bounded) 18 total1 = sum(amount_bounded) 19 private_bounded.append(total)

/tmp/ipykernel_26944/201478322.py in private_per_day_amount_bounded(lt) 1 # Calculate Differentially private amount 2 def private_per_day_amount_bounded(lt): ----> 3 x = BoundedSum(epsilon, MIN_EUROS_SPENT, MAX_EUROS_SPENT, 4) # MAX_CONTRIBUTED_DAYS 4 return x.quick_result(lt)

~/miniconda3/envs/pysyft/lib/python3.7/site-packages/pydp/algorithms/_algorithm.py in init(self, epsilon, delta, lower_bound, upper_bound, l0_sensitivity, linf_sensitivity, dtype) 193 l0_sensitivity=l0_sensitivity, 194 linf_sensitivity=linf_sensitivity, --> 195 dtype=dtype, 196 )

~/miniconda3/envs/pysyft/lib/python3.7/site-packages/pydp/algorithms/_algorithm.py in init(self, kwargs) 25 26 self.dtype = dtype ---> 27 self._algorithm = class(kwargs) 28 self._l0_sensitivity = kwargs.get("l0_sensitivity", "Not set") 29 self._linf_sensitivity = kwargs.get("linf_sensitivity", "Not set")

RuntimeError: INVALID_ARGUMENT: Lower bound cannot be greater than upper bound. `

System Information

OS: ubuntu18.04 Language Version: Python 3.7.10 Package Manager Version: [conda 4.12.0 Browser (if applicable): [ Google Chrome] Browser Version (if applicable): [Version 98.0.4758.102 (Official Build) (64-bit)]

Additional Context

Add any other context about the problem here.

chinmayshah99 commented 2 years ago

Hi @lmaxeniro, we have fixed this now. Let me know if this is still an issue.