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.1 dev release, we have added all functions required in carrots demo.

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 automatically 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 introduction
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 Distributions

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

Built Distributions

python_dp-0.1.7-cp38-cp38-manylinux1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.8

python_dp-0.1.7-cp38-cp38-macosx_10_15_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.8 macOS 10.15+ x86-64

python_dp-0.1.7-cp37-cp37m-manylinux1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.7m

python_dp-0.1.7-cp37-cp37m-macosx_10_15_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.7m macOS 10.15+ x86-64

python_dp-0.1.7-cp36-cp36m-manylinux1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.6m

python_dp-0.1.7-cp36-cp36m-macosx_10_15_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.6m macOS 10.15+ x86-64

python_dp-0.1.7-cp35-cp35m-manylinux1_x86_64.whl (2.8 MB view hashes)

Uploaded CPython 3.5m

python_dp-0.1.7-cp35-cp35m-macosx_10_15_x86_64.whl (2.9 MB view hashes)

Uploaded CPython 3.5m macOS 10.15+ x86-64

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