code: Final experiment corrections
This commit is contained in:
parent
427fbaf0ff
commit
f9c28dd03f
@ -118,15 +118,15 @@ def main(args):
|
||||
# Plot bars
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_s_sel,
|
||||
mae_s,
|
||||
bar_width,
|
||||
label='Skip',
|
||||
linewidth=lmdk_lib.line_width
|
||||
)
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_s,
|
||||
marker='_',
|
||||
mae_s_sel,
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
@ -135,15 +135,15 @@ def main(args):
|
||||
x_offset += bar_width
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_u_sel,
|
||||
mae_u,
|
||||
bar_width,
|
||||
label='Uniform',
|
||||
linewidth=lmdk_lib.line_width
|
||||
)
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_u,
|
||||
marker='_',
|
||||
mae_u_sel,
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
@ -152,15 +152,15 @@ def main(args):
|
||||
x_offset += bar_width
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_a_sel,
|
||||
mae_a,
|
||||
bar_width,
|
||||
label='Adaptive',
|
||||
linewidth=lmdk_lib.line_width
|
||||
)
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_a,
|
||||
marker='_',
|
||||
mae_a_sel,
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
|
@ -45,7 +45,7 @@ def main(args):
|
||||
x_margin = bar_width*(len(dist_type)/2 + 1)
|
||||
plt.xlim(x_i.min() - x_margin, x_i.max() + x_margin)
|
||||
# The y axis
|
||||
plt.ylabel('Privacy loss') # Set y axis label.
|
||||
plt.ylabel('Temporal privacy loss') # Set y axis label.
|
||||
plt.yscale('log')
|
||||
plt.ylim(epsilon/10, 100*len(seq))
|
||||
# plt.ylim(0, 10000)
|
||||
@ -55,15 +55,15 @@ def main(args):
|
||||
e = np.zeros(len(lmdk_n))
|
||||
a = np.zeros(len(lmdk_n))
|
||||
for i, n in enumerate(lmdk_n):
|
||||
for r in range(args.reps):
|
||||
for r in range(args.iter):
|
||||
# Generate landmarks
|
||||
lmdks = lmdk_lib.get_lmdks(seq, n, d)
|
||||
# Uniform budget allocation
|
||||
e_cur = lmdk_bgt.uniform(seq, lmdks, epsilon)
|
||||
_, _, a_cur = gdp.tpl_lmdk_mem(e_cur, p, p, seq, lmdks)
|
||||
# Save privacy loss
|
||||
e[i] += np.sum(e_cur)/args.reps
|
||||
a[i] += np.sum(a_cur)/args.reps
|
||||
e[i] += np.sum(e_cur)/args.iter
|
||||
a[i] += np.sum(a_cur)/args.iter
|
||||
# Set label
|
||||
label = lmdk_lib.dist_type_to_str(d_i)
|
||||
if d_i == 1:
|
||||
@ -98,7 +98,7 @@ def main(args):
|
||||
Parse arguments.
|
||||
|
||||
Optional:
|
||||
reps - The number of repetitions.
|
||||
iter - The number of iterations.
|
||||
time - The time limit of the sequence.
|
||||
'''
|
||||
def parse_args():
|
||||
@ -108,7 +108,7 @@ def parse_args():
|
||||
# Mandatory arguments.
|
||||
|
||||
# Optional arguments.
|
||||
parser.add_argument('-r', '--reps', help='The number of repetitions.', type=int, default=1)
|
||||
parser.add_argument('-i', '--iter', help='The number of iterations.', type=int, default=1)
|
||||
parser.add_argument('-t', '--time', help='The time limit of the sequence.', type=int, default=100)
|
||||
|
||||
# Parse arguments.
|
||||
|
@ -113,15 +113,15 @@ def main(args):
|
||||
# Plot bars
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_s_sel,
|
||||
mae_s,
|
||||
bar_width,
|
||||
label='Skip',
|
||||
linewidth=lmdk_lib.line_width
|
||||
)
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_s,
|
||||
marker='_',
|
||||
mae_s_sel,
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
@ -130,15 +130,15 @@ def main(args):
|
||||
x_offset += bar_width
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_u_sel,
|
||||
mae_u,
|
||||
bar_width,
|
||||
label='Uniform',
|
||||
linewidth=lmdk_lib.line_width
|
||||
)
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_u,
|
||||
marker='_',
|
||||
mae_u_sel,
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
@ -147,15 +147,15 @@ def main(args):
|
||||
x_offset += bar_width
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_a_sel,
|
||||
mae_a,
|
||||
bar_width,
|
||||
label='Adaptive',
|
||||
linewidth=lmdk_lib.line_width
|
||||
)
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_a,
|
||||
marker='_',
|
||||
mae_a_sel,
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
|
@ -137,15 +137,15 @@ def main(args):
|
||||
# Plot bars
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_s_sel,
|
||||
mae_s,
|
||||
bar_width,
|
||||
label='Skip',
|
||||
linewidth=lmdk_lib.line_width
|
||||
)
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_s,
|
||||
marker='_',
|
||||
mae_s_sel,
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
@ -154,15 +154,15 @@ def main(args):
|
||||
x_offset += bar_width
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_u_sel,
|
||||
mae_u,
|
||||
bar_width,
|
||||
label='Uniform',
|
||||
linewidth=lmdk_lib.line_width
|
||||
)
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_u,
|
||||
marker='_',
|
||||
mae_u_sel,
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
@ -171,7 +171,7 @@ def main(args):
|
||||
x_offset += bar_width
|
||||
plt.bar(
|
||||
x_i + x_offset,
|
||||
mae_a_sel,
|
||||
mae_a,
|
||||
bar_width,
|
||||
label='Adaptive',
|
||||
linewidth=lmdk_lib.line_width
|
||||
@ -179,7 +179,7 @@ def main(args):
|
||||
plt.plot(
|
||||
x_i + x_offset,
|
||||
mae_a,
|
||||
marker='_',
|
||||
marker='+',
|
||||
markersize=lmdk_lib.marker_size + lmdk_lib.line_width,
|
||||
markeredgewidth=lmdk_lib.line_width,
|
||||
markeredgecolor='#bdbdbd',
|
||||
|
Loading…
Reference in New Issue
Block a user