lmdk_bgt.adaptive: Added parameters for samp_rt

This commit is contained in:
Manos Katsomallos 2021-07-25 16:53:05 +03:00
parent 7dc347cf53
commit 44b1ac7e9c

View File

@ -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