From f9c28dd03f6e2bc59e7ef21667a3e5fff4a1b22f Mon Sep 17 00:00:00 2001 From: Manos Katsomallos Date: Fri, 15 Oct 2021 14:40:02 +0200 Subject: [PATCH] code: Final experiment corrections --- code/expt/copenhagen-sel.py | 18 +++++++++--------- code/expt/dist_cor.py | 12 ++++++------ code/expt/hue-sel.py | 18 +++++++++--------- code/expt/t-drive-sel.py | 16 ++++++++-------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/code/expt/copenhagen-sel.py b/code/expt/copenhagen-sel.py index 516c395..861cac4 100644 --- a/code/expt/copenhagen-sel.py +++ b/code/expt/copenhagen-sel.py @@ -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', diff --git a/code/expt/dist_cor.py b/code/expt/dist_cor.py index 039c5db..f5229bb 100644 --- a/code/expt/dist_cor.py +++ b/code/expt/dist_cor.py @@ -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. diff --git a/code/expt/hue-sel.py b/code/expt/hue-sel.py index 146c3bd..4efe324 100644 --- a/code/expt/hue-sel.py +++ b/code/expt/hue-sel.py @@ -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', diff --git a/code/expt/t-drive-sel.py b/code/expt/t-drive-sel.py index 862dbda..9ba6bef 100644 --- a/code/expt/t-drive-sel.py +++ b/code/expt/t-drive-sel.py @@ -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',