From 44b1ac7e9ce2edce47dbd8a1f7b06fd001b6c366 Mon Sep 17 00:00:00 2001 From: Manos Katsomallos Date: Sun, 25 Jul 2021 16:53:05 +0300 Subject: [PATCH] lmdk_bgt.adaptive: Added parameters for samp_rt --- code/lib/lmdk_bgt.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/code/lib/lmdk_bgt.py b/code/lib/lmdk_bgt.py index 044988c..ce72de4 100644 --- a/code/lib/lmdk_bgt.py +++ b/code/lib/lmdk_bgt.py @@ -286,7 +286,7 @@ def stepped(seq, lmdks, epsilon): return bgts -def adaptive(seq, lmdks, epsilon): +def adaptive(seq, lmdks, epsilon, inc_rt, dec_rt): ''' Adaptive budget allocation. @@ -294,6 +294,8 @@ def adaptive(seq, lmdks, epsilon): seq - The point sequence. lmdks - The landmarks. epsilon - The available privacy budget. + inc_rt - Sampling rate increase rate. + dec_rt - Sampling rate decrease rate. Returns: rls_data - The perturbed data. bgts - The privacy budget allocation. @@ -323,18 +325,10 @@ def adaptive(seq, lmdks, epsilon): if i > 0: if distance((rls_data[i - 1][1], rls_data[i - 1][2]), new_loc).km*1000 < 1/bgts[i]: # Decrease - # samp_rt -= samp_rt*.9 - # samp_rt -= samp_rt*.75 - samp_rt -= samp_rt*.5 - # samp_rt -= samp_rt*.25 - # samp_rt -= samp_rt*.1 + samp_rt -= samp_rt*dec_rt else: # Increase - # samp_rt += (1 - samp_rt)*.9 - # samp_rt += (1 - samp_rt)*.75 - samp_rt += (1 - samp_rt)*.5 - # samp_rt += (1 - samp_rt)*.25 - # samp_rt += (1 - samp_rt)*.1 + samp_rt += (1 - samp_rt)*inc_rt else: skipped += 1 # Skip current release and approximate with previous