Skip to main content

Empirical Estimation of Differential Privacy

This repository provides utilities for estimating DP-$\varepsilon$ from the confusion matrix of a membership inference attack based on the paper Bayesian Estimation of Differential Privacy.

Installation

Simply run the following command to install the privacy-estimates python package. It should install all the relevant dependencies as well.

pip install privacy-estimates

Example

The following command takes the output of a membership inference attack on a target model or multiples models in the form of true positives (TP), true negatives (TN), false positives (FP) and false negatives (FN). It also requires the value for $\alpha$ which states the significance level of the estimate for two sided intervals of the estimated $\varepsilon$ value.

For example, we can post-proces the attack outputs of a CNN trained on CIFAR10 with $(\varepsilon = 10, \delta = 10^{-5})$ by running

python scripts/estimate-epsilon.py --alpha 0.1 --delta 1e-5 --TP 487 --TN 1 --FP 512 --FN 0 

This should take approximately 5 minutes and produce the following output

Method             Interval                Significance level  eps_lo  eps_hi
Joint beta (ours)  two-sided equal-tailed  0.100               0.145   6.399
Joint beta (ours)  one-sided               0.050               0.145   inf
Clopper Pearson    two-sided equal-tailed  0.100               0.000   inf
Clopper Pearson    one-sided               0.050               0.000   inf
Jeffreys           two-sided equal-tailed  0.100               0.000   inf
Jeffreys           one-sided               0.050               0.000   inf

Tests

We provide a few test cases which can be run by

pytest .

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Metadata

Release files for privacy-estimates 0.1.0.post1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for privacy-estimates 0.1.0.post1
File Size Uploaded
privacy-estimates-0.1.0.post1.tar.gz 10.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for privacy-estimates 0.1.0.post1
File Interpreter ABI Platform
privacy_estimates-0.1.0.post1-py3-none-any.whl Python 3 none any Details

Total release size: 21.5 kB

Release files / privacy-estimates-0.1.0.post1.tar.gz

Download URL privacy-estimates-0.1.0.post1.tar.gz
Size 10.2 kB
Tags Source
SHA-256 checksum
How to use checksums
9798d528382f728ab522a3e71fc8c407444f846fb034397d11db29bd2e0d3172
BLAKE2b-256 checksum
How to use checksums
11eff41e41da4d597d83a0a2146652cc8df19488f10c3875f1fe898628238bdc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release files / privacy_estimates-0.1.0.post1-py3-none-any.whl

Download URL privacy_estimates-0.1.0.post1-py3-none-any.whl
Size 11.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b81244787a74f07534d208ef89475207d8ee01013d505dc191f0266d26e5f0e4
BLAKE2b-256 checksum
How to use checksums
d88eb7604fb880fbb823303650bc8a4891b256b7ce675e7d3f1e074251247adf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.1 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.0.post1 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page