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
pip install nprr
Organization
The package is organized into two main submodules:
nprr.mechanismsimplements privacy mechanisms including the NPRR and Laplace mechanisms along with utilities for working with them.nprr.dpcsimplements 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.cgfimplements some cumulant generating functions (CGF) and CGF-like functions that are used throughout thenprr.dpcsmodule.nprr.plottingimplements functions for producing the plots found in the paper.nprr.typesimplements 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.
- 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
- Install the package and its dependencies.
python install -e ./
- Enter the plots directory.
cd plots
- 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
Metadata
Release files for nprr 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nprr-0.1.4.tar.gz | 12.4 kB | Without provenance | Details for nprr-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nprr-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for nprr-0.1.4-py3-none-any.whl |
Total release size: 25.2 kB
Release files / nprr-0.1.4.tar.gz
| Download URL | nprr-0.1.4.tar.gz |
|---|---|
| Size | 12.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
60c58e2c50d696f297b44da5f6f40e9f95ff52c990260c54fb03357e084569b2
|
|
BLAKE2b-256 checksum How to use checksums |
0eebf802a17ff44f7c871a5e5c0ef92c6d8040c194508717c3a3e38868fdad07
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Release files / nprr-0.1.4-py3-none-any.whl
| Download URL | nprr-0.1.4-py3-none-any.whl |
|---|---|
| Size | 12.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d555b626bfb5c6102ff460c95cc98d18912afc147293f0037c2971e1bd4eebfe
|
|
BLAKE2b-256 checksum How to use checksums |
c504e699c551c3702154eb5386633b7a4cfc61cb05885af2571423b9dca4be9e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.9.16
|
Security for nprr 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.