Skip to main content

Subsampling transformations and utilities for Privacy Loss Distribution (PLD) PMFs

Project description

PLD_subsampling

Implements and evaluates privacy amplification by subsampling for Privacy Loss Distribution (PLD) probability mass functions (PMFs). Generates CDF plots and epsilon ratio plots comparing analytical ground truth, dp-accounting, and our direct subsampling implementation.

Package layout

  • PLD_subsampling/
    • PLD_subsampling_impl.py: Core subsampling primitives
      • stable_subsampling_loss: numerically stable loss mapping
      • exclusive_ccdf_from_pdf: CCDF helper (exclusive tail)
      • subsample_losses: transforms a PMF on a uniform loss grid
    • wrappers/dp_accounting_wrappers.py: Thin wrappers around dp-accounting (construct PLDs, amplify PLDs separately for remove/add), plus PMF bridge utilities
      • amplify_pld_separate_directions(base_pld, sampling_prob, return_pld=False): returns a dict with 'pmf_remove' and 'pmf_add'. If return_pld=True, attempts to build a PrivacyLossDistribution from the two PMFs, falling back to the dict if unsupported by the installed dp-accounting version.
    • testing/
      • analytic_Gaussian.py: Analytical PLD and epsilon(δ) formulas for Gaussian mechanism
      • test_utils.py: Experiment runners (run_experiment, run_multiple_experiments)
      • plot_utils.py: Plotting (CDF with focused x-range, epsilon ratio)
    • main.py: Runs experiments and saves figures to plots/

Quickstart

  1. Create a virtual environment and install dependencies
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
pip install -r requirements.txt
  1. Editable install for local development (optional)
pip install -e .
  1. Run experiments and generate plots
python -m PLD_subsampling.main

Figures are written to plots/ (treat this directory as build output).

Notes

  • CDF plots automatically focus the main x-axis on the transition region and add slight y-padding to show the 0 and 1 limits clearly.
  • Epsilon-ratio plots show method/GT vs analytical epsilon over log-scale epsilon.
  • All heavy computations use vectorized NumPy operations with careful numerical handling in tail regions.

Build a package

python -m pip install --upgrade build
python -m build

Artifacts will be created under dist/. To upload to PyPI/TestPyPI, use twine with an API token.

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

pld_subsampling-0.1.1.tar.gz (12.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pld_subsampling-0.1.1-py3-none-any.whl (13.6 kB view details)

Uploaded Python 3

File details

Details for the file pld_subsampling-0.1.1.tar.gz.

File metadata

  • Download URL: pld_subsampling-0.1.1.tar.gz
  • Upload date:
  • Size: 12.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.6

File hashes

Hashes for pld_subsampling-0.1.1.tar.gz
Algorithm Hash digest
SHA256 0629e6b5d7d9c2b63ae1ddc962b49939a7435a5e8f300977bbab884e4c3744e2
MD5 d8237385c75e990292feca4e7919a660
BLAKE2b-256 618635c7e1a72befd59d5aae9b9a6413b9e17d58bcaba1bb7150416a8cf41406

See more details on using hashes here.

File details

Details for the file pld_subsampling-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pld_subsampling-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8df911a58e7453db1cb011b5b4d204dfe0598d6c6a3466c115d81b5b6c1abc6d
MD5 4e4339d0437fef964ce60d2dde5f3d56
BLAKE2b-256 91140f10d5f165bf75a8fb3dcaf169a9b0ea41246e13300387aefe7515206e92

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page