From 1a448b42724f99ca41bc4ece8b6f631cc771d5b1 Mon Sep 17 00:00:00 2001 From: "A. Unique TensorFlower" Date: Mon, 13 Jan 2020 14:06:51 -0800 Subject: [PATCH] Document how to set delta. Document orders list in eps computation. PiperOrigin-RevId: 289514598 --- tutorials/mnist_dpsgd_tutorial.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/tutorials/mnist_dpsgd_tutorial.py b/tutorials/mnist_dpsgd_tutorial.py index aad0410..3dc990d 100644 --- a/tutorials/mnist_dpsgd_tutorial.py +++ b/tutorials/mnist_dpsgd_tutorial.py @@ -60,11 +60,21 @@ class EpsilonPrintingTrainingHook(tf.estimator.SessionRunHook): self._samples, self._queries = ledger.get_unformatted_ledger() def end(self, session): + + # Any RDP order (for order > 1) corresponds to one epsilon value. We + # enumerate through a few orders and pick the one that gives lowest epsilon. + # The variable orders may be extended for different use cases. Usually, the + # search is set to be finer-grained for small orders and coarser-grained for + # larger orders. orders = [1 + x / 10.0 for x in range(1, 100)] + list(range(12, 64)) samples = session.run(self._samples) queries = session.run(self._queries) formatted_ledger = privacy_ledger.format_ledger(samples, queries) rdp = compute_rdp_from_ledger(formatted_ledger, orders) + + # It is recommended that delta is o(1/dataset_size). In the case of MNIST, + # dataset_size is 60000, so we set delta to be 1e-5. For larger datasets, + # delta should be set smaller. eps = get_privacy_spent(orders, rdp, target_delta=1e-5)[0] print('For delta=1e-5, the current epsilon is: %.2f' % eps)