Skip to main content

Python API for Google's Differential Privacy library

Project description

Introduction

PyDP is a Python wrapper for Google's Differential Privacy project. The library provides a set of ε-differentially private algorithms, which can be used to produce aggregate statistics over numeric data sets containing private or sensitive information.

PyDP is part of the OpenMined community, come join the movement on Slack.

Instructions

If you'd like to contribute to this project please read these guidelines.

Usage

As part of the 0.1.0 dev release, we have managed to port the Private Mean function (Bounded Mean). Other functions will be released in further release.

To install the package: pip install python-dp

import pydp as dp # imports the DP library

# To calculate the Bounded Mean
# epsilon is a number between 0 and 1 denoting privacy threshold
# It measures the acceptable loss of privacy (with 0 meaning no loss is acceptable)
# If both the lower and upper bounds are specified, 
# x = dp.BoundedMean(epsilon: double, lower: int, upper: int)
x = dp.BoundedMean(0.6, 1, 10)

# If lower and upper bounds are not specified, 
# DP library automtaically calculates these bounds
# x = dp.BoundedMean(epsilon: double)
x = dp.BoundedMean(0.6)

# To get the result
# Currently supported data types are integer and float. Future versions will support additional data types
# Refer to examples/carrots.py for an example
x.result(input_data: list)

Known issue: If the privacy budget (epsilon is too less), we get a StatusOR error in the command line. While this needs to be raised as an error, right now, it's just displayed as an error in Logs.

Project details


Download files

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

Source Distribution

python-dp-0.1.0.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

python_dp-0.1.0-py2.py3-none-any.whl (3.6 MB view details)

Uploaded Python 2 Python 3

File details

Details for the file python-dp-0.1.0.tar.gz.

File metadata

  • Download URL: python-dp-0.1.0.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for python-dp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 5feb68312463a10511b31ea5e2c123b400bc5f756b148c86028b0e64c5565c1b
MD5 21a25216a75c9c97d9dbd5c43ac0ed23
BLAKE2b-256 f8dd6224817c23092a86fda47d7468e0046135a6b0487f2ece77fbee83adfbc3

See more details on using hashes here.

File details

Details for the file python_dp-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: python_dp-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 3.6 MB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/46.1.3 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.6.9

File hashes

Hashes for python_dp-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 05413bbd7ea961d0de2c483c392b7c675ee09afe63a58e4e2a6f6e54f49d2ab4
MD5 764c9b7041e843674910eda44ec1afb9
BLAKE2b-256 ddfb7383d552f093c0cb0cc71a550eaa1c4bd504f3c62b267888c19ff0a8167d

See more details on using hashes here.

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