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