Example #1
0
 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('***************************************************')
Example #3
0
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)