Skip to main content

A Differential Privacy Package

Project description

DiffPriv Logo

PyPI Version Language

Welcome to DiffPriv v0.1.1

DiffPriv is a collection of different defferential privacy algorithms. From the Laplace Mechanism to the simple Random Response mechanism, use differential privacy in your data easily with DiffPriv.

Our world is full of data. Our world is data.

So let's protect it. Easily.

photo of room with light up text saying, 'Data has a better idea'

Photo by Franki Chamaki

Downloading DIffPriv

To download, open up you command prompt and type

python3 -m pip install DiffPriv

How to Use

Now import DiffPriv.

from DiffPriv import private

The first method we will use is the Random Response Mechanism. To use this, we use the randresponse() function. You only need to pass one parameter.

randresponse(response_list)

Response list, the parameter, is the list of data or responses in a form. Make sure you know how the random response mechansim works before you use it.

The next method we can use is the laplace mechanism. To use the laplace function, we use the lapmech() function.

lapmech(data, file_name, epsilon, f, sample_size=10, delta_f=None)

This will return a new dataset that is differentially privatized. @q9i's differential privacy wiki page on the laplace mechanism is a great explainer. You can view it here. You should also make sure you know how the laplace mechanism works.

The last method we will use is the exponetial mechanism. We will use the expmech() function.

expmech(data, file_name, epsilon, f, r, sample_size=10, delta_f=None)

A lot of these are the same parameters from the lapmech() function, but r is new. r is any valid python range. So you can just use range(0, 10) or something like that. But again, make sure you know what the exponential mechansim is before you use it.

Contributors

View on PyPI - https://pypi.org/project/DiffPriv

Homepage - https://quantalabs.github.io/DiffPriv

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

DiffPriv-0.1.1-py3-none-any.whl (16.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page