OpenMined / PyDP

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

Test datatype for when passed for compuation #204

Open chinmayshah99 opened 4 years ago

chinmayshah99 commented 4 years ago

Description

When we call the result function, we just pass the python list as it is.

x = pydp.BoundedMean(1.0)
x.result([1,2,3,4])

What would be great is mention the datatype of the list in another argument, x.result([1,2,3,4], 'int') We want the new function definition to have the datatype as one of the argument, with float as the default argument. Note: The function definition of result below is for representation purpose and the original code will be in c++ (pybind11).

def result(list, datatype= 'float'): 
  pass

The idea behind doing this is if we know the datatype, the underlying c++ code can become a lot efficient as right now, we are just converting everything to float.

codeboy5 commented 4 years ago

Are we planning to do this for every function ?

chinmayshah99 commented 4 years ago

Yes

On Wed, 29 Jul 2020 at 18:28, Saksham notifications@github.com wrote:

Are we planning to do this for every function ?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/OpenMined/PyDP/issues/204#issuecomment-665647901, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACTTOFMGXH4GOEEYZE5AP3LR6AMGJANCNFSM4PK6LODQ .

-- Regards

Chinmay Shah

codeboy5 commented 4 years ago

I can take this up, I will try to add them for the util functions first and we can expand from it If everything works as expected .

chinmayshah99 commented 4 years ago

We have already added datatype in #249 . We just need to make sure we do the cast, at the same time raise a warning.