A Differential Privacy Package
Project description
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 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
- @quanatum9innovation - https://github.com/quantum9innovation
- @quantalabs -https://github.com/quantalabs
View on PyPI - https://pypi.org/project/DiffPriv
Homepage - https://quantalabs.github.io/DiffPriv
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
File details
Details for the file DiffPriv-0.1.1-py3-none-any.whl
.
File metadata
- Download URL: DiffPriv-0.1.1-py3-none-any.whl
- Upload date:
- Size: 16.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.8.1
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df60370a2e4052cd84012b2ead26e1f73ea8db2c6abfdf749bb1002532e0e762 |
|
MD5 | 979f2bff60c5b60abb6bc6bc3d44025a |
|
BLAKE2b-256 | c45c893395eaaf1d0e74426e6c155c009131bd6f9b119ee8e32eba4e178ad626 |