lmdk_bgt.adaptive: Added parameters for samp_rt
This commit is contained in:
parent
7dc347cf53
commit
44b1ac7e9c
@ -286,7 +286,7 @@ def stepped(seq, lmdks, epsilon):
|
|||||||
return bgts
|
return bgts
|
||||||
|
|
||||||
|
|
||||||
def adaptive(seq, lmdks, epsilon):
|
def adaptive(seq, lmdks, epsilon, inc_rt, dec_rt):
|
||||||
'''
|
'''
|
||||||
Adaptive budget allocation.
|
Adaptive budget allocation.
|
||||||
|
|
||||||
@ -294,6 +294,8 @@ def adaptive(seq, lmdks, epsilon):
|
|||||||
seq - The point sequence.
|
seq - The point sequence.
|
||||||
lmdks - The landmarks.
|
lmdks - The landmarks.
|
||||||
epsilon - The available privacy budget.
|
epsilon - The available privacy budget.
|
||||||
|
inc_rt - Sampling rate increase rate.
|
||||||
|
dec_rt - Sampling rate decrease rate.
|
||||||
Returns:
|
Returns:
|
||||||
rls_data - The perturbed data.
|
rls_data - The perturbed data.
|
||||||
bgts - The privacy budget allocation.
|
bgts - The privacy budget allocation.
|
||||||
@ -323,18 +325,10 @@ def adaptive(seq, lmdks, epsilon):
|
|||||||
if i > 0:
|
if i > 0:
|
||||||
if distance((rls_data[i - 1][1], rls_data[i - 1][2]), new_loc).km*1000 < 1/bgts[i]:
|
if distance((rls_data[i - 1][1], rls_data[i - 1][2]), new_loc).km*1000 < 1/bgts[i]:
|
||||||
# Decrease
|
# Decrease
|
||||||
# samp_rt -= samp_rt*.9
|
samp_rt -= samp_rt*dec_rt
|
||||||
# samp_rt -= samp_rt*.75
|
|
||||||
samp_rt -= samp_rt*.5
|
|
||||||
# samp_rt -= samp_rt*.25
|
|
||||||
# samp_rt -= samp_rt*.1
|
|
||||||
else:
|
else:
|
||||||
# Increase
|
# Increase
|
||||||
# samp_rt += (1 - samp_rt)*.9
|
samp_rt += (1 - samp_rt)*inc_rt
|
||||||
# samp_rt += (1 - samp_rt)*.75
|
|
||||||
samp_rt += (1 - samp_rt)*.5
|
|
||||||
# samp_rt += (1 - samp_rt)*.25
|
|
||||||
# samp_rt += (1 - samp_rt)*.1
|
|
||||||
else:
|
else:
|
||||||
skipped += 1
|
skipped += 1
|
||||||
# Skip current release and approximate with previous
|
# Skip current release and approximate with previous
|
||||||
|
Loading…
Reference in New Issue
Block a user