Skip to main content

Nonparametric randomized response and locally private confidence sets

Project description

NPRR: Nonparametric randomized response

This code implements the nonparametric randomized response (NPRR) mechanism as well as methods for computing locally differentially private confidence intervals and sequences from NPRR's output. The methods are based on the paper "A nonparametric extension of randomized response for private confidence sets" by Ian Waudby-Smith, Zhiwei Steven Wu, and Aaditya Ramdas (2023).

Installation

This won't work yet — we're going to put it on PyPi soon.

To install the package, run the following in a terminal:

pip install nprr

Organization

The package is organized into two main submodules:

  • nprr.mechanisms implements privacy mechanisms including the NPRR and Laplace mechanisms along with utilities for working with them.
  • nprr.dpcs implements the confidence intervals and sequences from the paper as well as utilities for working with them.

In addition, the package contains the following submodules:

  • nprr.cgf implements some cumulant generating functions (CGF) and CGF-like functions that are used throughout the nprr.dpcs module.
  • nprr.plotting implements functions for producing the plots found in the paper.
  • nprr.types implements some basic type aliases used throughout the package.

Reproducing the plots from the paper

Please begin the following steps from the root of the nprr directory.

  1. Create and activate a virtual environment using the method of your choice. We used venv, e.g.
python3.9 -m venv venv_dpconc

source venv_dpconc/bin/activate
  1. Install the package and its dependencies.
python install -e ./
  1. Enter the plots directory.
cd plots
  1. Generate figures.
### Figure 1 ###
python hoeffding_eps.py
# -> output file: bounded_beta_1_1_hoeffding_eps.pdf

### Figure 3 ###
python hoeffding_tightness_max.py
# -> output file: bounded_beta_50_50_tightness_max.pdf

### Figure 4 ###
python confint_bounded.py
# -> output file: bounded_beta_50_50_ci.pdf

### Figure 5 ###
python confseq_bounded.py
# -> output file: bounded_beta_50_50_cs.pdf

### Figure 6 ###
python two-sided-running-mean.py
# -> output file: wavy_cs.pdf

### Figure 7 ###
python ab-test.py
# -> output file: wavy_ipw_cs.pdf

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

nprr-0.1.3.tar.gz (12.6 kB view details)

Uploaded Source

Built Distribution

nprr-0.1.3-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file nprr-0.1.3.tar.gz.

File metadata

  • Download URL: nprr-0.1.3.tar.gz
  • Upload date:
  • Size: 12.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nprr-0.1.3.tar.gz
Algorithm Hash digest
SHA256 353e5f46c176169d32129fd177646d39f93a88dd790d369c28d6cf81fad00965
MD5 ed0852400490563141f5e40ccf418a79
BLAKE2b-256 33a5604e8e2adf6f0f5412dbe4001c59fed58991f88be8ace5ac3e82a051a2d6

See more details on using hashes here.

Provenance

File details

Details for the file nprr-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: nprr-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.16

File hashes

Hashes for nprr-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 80f6d8e9f16828a127eea4eee697350a7eee54dff70c675db21c5aa9e9260193
MD5 af3feef9628f93e1ad15eb9a0c2f5b2e
BLAKE2b-256 edc3c5ce47a69e96843957d590147d02ca9db55d5a43df25ffdf24cdcd5ae9d9

See more details on using hashes here.

Provenance

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