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 "carrots_demo" notebook, the private_max(privacy_budget: float) does not work #409

Closed lmaxeniro closed 2 years ago

lmaxeniro commented 2 years ago

Description

running the "carrots_demo" notebook, the function private_max(privacy_budget: float) does not work

How to Reproduce

run the notebook line by line, everything else is OK, but when running print("Private max:\t" + str(private_max(1))), these error is throw out, regardless of whatever privacy_budget value is given.

`--------------------------------------------------------------------------- TypeError Traceback (most recent call last) /tmp/ipykernel_16495/701996227.py in 1 print("Max:\t" + str(max())) ----> 2 print("Private max:\t" + str(private_max(1)))

/tmp/ipykernel_16495/4291276915.py in private_max(privacy_budget) 2 def private_max(privacy_budget: float) -> int: 3 # 0 and 150 are the upper and lower limits for the search bound. ----> 4 x = Max(privacy_budget, 0, 100, dtype="int") 5 return x.quick_result(list(df["carrots_eaten"]))

~/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")

TypeError: init(): incompatible constructor arguments. The following argument types are supported:

  1. _algorithms.MaxInt(epsilon: float, delta: float = 0, lower_bound: int, upper_bound: int, l0_sensitivity: int = 1, linf_sensitivity: int = 1)
  2. _algorithms.MaxInt(epsilon: float, delta: float = 0, l0_sensitivity: int = 1, linf_sensitivity: int = 1)

Invoked with: kwargs: epsilon=1, lower_bound=100, l0_sensitivity=1, linf_sensitivity=1`

System Information

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.