This repository provides the python3 implementation for Skellam Mixture Mechanism.
scipy, numpy, tensorflow, and log_maths.py for logarithm mathematics as used in tf-privacy.
An example python script for computing the privacy guarantee of SMM for distributed sum estimation task is as follows.
python3 smm_dse_analysis.py --gamma=64 --mu=5.95
By default, we estimate the privacy parameter
By setting the l-infinity clipping bound to
python3 smm_dse.py --gamma=64 --mu=5.95 --l_inf=5.94 --bits=32
An example python script for computing the privacy guarantee of SMM for MNIST is as follows.
python3 smm_mnist.py --rounds=1000 --n=240 --c=4096 --gamma=64 --mu=5.95 --bits=8 --l_inf=4.73
Here we run SMM for
python smm_analysis.py --epochs=4 --c=4096 --n=240 --mu=5.95
We provide an alternative implementation for SMM with Fast Walsh-Hadamard transform (FWHT, see https://en.wikipedia.org/wiki/Fast_Walsh%E2%80%93Hadamard_transform), instead of direct matrix-vector multiplication. SMM with FWHT saves memory consumption. Our implementation utilizes the FWHT library (see https://github.com/FALCONN-LIB/FFHT). An example script is as follows.
python smm_mnist_ffht.py --rounds=1000 --n=240 --c=4096 --gamma=64 --mu=5.95 --bits=8 --l_inf=4.73
Script skellam.py
under folder exact_skellam
benchmarks the running time for generating symmetric Skellam variates in python. An example script, which repeatedly generates of
python3 skellam.py --mx=8 --my=3 --size=100 --m=10
As a symmetric Skellam variate is the difference between two independent Poisson variates of the same variance, the task of generating exact Skellam variate reduces to generating exact Poisson variates, which is based on Duchon and Duvignau, 2016 (see Algorithm 1 in https://www.combinatorics.org/ojs/index.php/eljc/article/view/v23i4p22/pdf), Devorye, 1986 (see page 487 in http://www.eirene.de/Devroye.pdf), and the pseudo code by Peter Occil (see https://github.com/peteroupc/peteroupc.github.io/blob/master/randomfunc.md#Poisson_Distribution). In our implementation for the exact Poisson sampler, we adopt the convention that randrange()
(see https://docs.python.org/3/library/random.html) is the only accessible randomness.
Script poisson_test.py
under folder exact_skellam
benchmarks the running time for generating Poisson variates in python and evaluates the distance from the empirical distribution to the underlying Poisson distribution under KL divergence (see https://en.wikipedia.org/wiki/Kullback%E2%80%93Leibler_divergence). An example script, which generates of
python3 poisson_test.py --mx=4 --my=3 --n=100