def end(self, session): 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) eps = get_privacy_spent(orders, rdp, target_delta=1e-5)[0] print('For delta=1e-5, the current epsilon is: %.2f' % eps)
def end(self, session): 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) eps = get_privacy_spent(orders, rdp, target_delta=FLAGS.delta)[0] print('***************************************************') f=open(FLAGS.record_dir + "/" + FLAGS.record_file, "a+") f.write('For delta='+ str(FLAGS.delta) + ', the current epsilon is: %.2f \n' % eps) print('For delta='+ str(FLAGS.delta) + ', the current epsilon is: %.2f' % eps) f.close() print('***************************************************')
def calc_epsilon(delta, ledger, sess): orders = [1 + x / 10. for x in range(1, 100)] + list(range(12, 64)) _samples, _queries = ledger.get_unformatted_ledger() print("samples: " + str(_samples.shape)) print("queries: " + str(_queries.shape)) samples = sess.run(_samples) queries = sess.run(_queries) print("samples: " + str(len(samples))) print("queries: " + str(len(queries))) formatted_ledger = privacy_ledger.format_ledger(samples, queries) rdp = compute_rdp_from_ledger(formatted_ledger, orders) epsilon = get_privacy_spent(orders, rdp, target_delta=delta)[0] return (epsilon)
def test_compute_rdp_from_ledger(self): orders = range(2, 33) q = 0.1 n = 1000 l2_norm_clip = 3.14159 noise_stddev = 2.71828 steps = 3 query_entry = privacy_ledger.GaussianSumQueryEntry( l2_norm_clip, noise_stddev) ledger = [privacy_ledger.SampleEntry(n, q, [query_entry])] * steps z = noise_stddev / l2_norm_clip rdp = rdp_accountant.compute_rdp(q, z, steps, orders) rdp_from_ledger = rdp_accountant.compute_rdp_from_ledger( ledger, orders) self.assertSequenceAlmostEqual(rdp, rdp_from_ledger)