diff --git a/code/expt/copenhagen-sel.py b/code/expt/copenhagen-sel.py index 99141fd..ab17d31 100644 --- a/code/expt/copenhagen-sel.py +++ b/code/expt/copenhagen-sel.py @@ -68,29 +68,30 @@ def main(args): for _ in range(args.iter): - lmdks, eps_out = lmdk_sel.find_lmdks(seq, lmdks, epsilon) + lmdks_sel, eps_out = lmdk_sel.find_lmdks(seq, lmdks, epsilon) # Skip - rls_data_s, bgts_s = lmdk_bgt.skip_cont(seq, lmdks, eps_out) + rls_data_s, bgts_s = lmdk_bgt.skip_cont(seq, lmdks_sel, eps_out) # lmdk_bgt.validate_bgts(seq, lmdks, epsilon, bgts_s) mae_s[i] += (lmdk_bgt.mae_cont(rls_data_s)/args.iter)*100 # Uniform - rls_data_u, bgts_u = lmdk_bgt.uniform_cont(seq, lmdks, eps_out) + rls_data_u, bgts_u = lmdk_bgt.uniform_cont(seq, lmdks_sel, eps_out) # lmdk_bgt.validate_bgts(seq, lmdks, epsilon, bgts_u) mae_u[i] += (lmdk_bgt.mae_cont(rls_data_u)/args.iter)*100 # Adaptive - rls_data_a, _, _ = lmdk_bgt.adaptive_cont(seq, lmdks, eps_out, .5, .5) + rls_data_a, _, _ = lmdk_bgt.adaptive_cont(seq, lmdks_sel, eps_out, .5, .5) mae_a[i] += (lmdk_bgt.mae_cont(rls_data_a)/args.iter)*100 # Calculate once - if i == 0: + if pct == lmdks_pct[0]: # Event - rls_data_evt, _ = lmdk_bgt.uniform_cont(seq, lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, 0), epsilon) + rls_data_evt, _ = lmdk_bgt.uniform_cont(seq, lmdks, epsilon) mae_evt += (lmdk_bgt.mae_cont(rls_data_evt)/args.iter)*100 + elif pct == lmdks_pct[-1]: # User - rls_data_usr, _ = lmdk_bgt.uniform_cont(seq, lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, 100), epsilon) + rls_data_usr, _ = lmdk_bgt.uniform_cont(seq, lmdks, epsilon) mae_usr += (lmdk_bgt.mae_cont(rls_data_usr)/args.iter)*100 plt.axhline( diff --git a/code/expt/copenhagen.py b/code/expt/copenhagen.py index aa9b514..acafe9a 100644 --- a/code/expt/copenhagen.py +++ b/code/expt/copenhagen.py @@ -80,12 +80,13 @@ def main(args): mae_a[i] += (lmdk_bgt.mae_cont(rls_data_a)/args.iter)*100 # Calculate once - if i == 0: + if pct == lmdks_pct[0]: # Event - rls_data_evt, _ = lmdk_bgt.uniform_cont(seq, lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, 0), epsilon) + rls_data_evt, _ = lmdk_bgt.uniform_cont(seq, lmdks, epsilon) mae_evt += (lmdk_bgt.mae_cont(rls_data_evt)/args.iter)*100 + elif pct == lmdks_pct[-1]: # User - rls_data_usr, _ = lmdk_bgt.uniform_cont(seq, lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, 100), epsilon) + rls_data_usr, _ = lmdk_bgt.uniform_cont(seq, lmdks, epsilon) mae_usr += (lmdk_bgt.mae_cont(rls_data_usr)/args.iter)*100 plt.axhline( diff --git a/code/expt/hue-sel.py b/code/expt/hue-sel.py index 22083f4..930bd54 100644 --- a/code/expt/hue-sel.py +++ b/code/expt/hue-sel.py @@ -48,7 +48,7 @@ def main(args): # The y axis plt.ylabel('Mean absolute error (kWh)') # Set y axis label. plt.yscale('log') - plt.ylim(.1, 10000) + plt.ylim(.1, 100000) # Bar offset x_offset = -(bar_width/2)*(n - 1) @@ -80,13 +80,13 @@ def main(args): mae_a[i] += lmdk_bgt.mae_cons(seq, rls_data_a)/args.iter # Calculate once - # Event - if i == 0: - rls_data_evt, _ = lmdk_bgt.uniform_cons(seq, seq[seq[:, 1] < lmdks_th[0]], epsilon) + if pct == lmdks_pct[0]: + # Event + rls_data_evt, _ = lmdk_bgt.uniform_cons(seq, lmdks, epsilon) mae_evt += lmdk_bgt.mae_cons(seq, rls_data_evt)/args.iter - # User - if i == 0: - rls_data_usr, _ = lmdk_bgt.uniform_cons(seq, seq[seq[:, 1] < lmdks_th[len(lmdks_th)-1]], epsilon) + elif pct == lmdks_pct[-1]: + # User + rls_data_usr, _ = lmdk_bgt.uniform_cons(seq, lmdks, epsilon) mae_usr += lmdk_bgt.mae_cons(seq, rls_data_usr)/args.iter plt.axhline( diff --git a/code/expt/hue.py b/code/expt/hue.py index cb4cb2e..5562b17 100644 --- a/code/expt/hue.py +++ b/code/expt/hue.py @@ -46,7 +46,7 @@ def main(args): # The y axis plt.ylabel('Mean absolute error (kWh)') # Set y axis label. plt.yscale('log') - plt.ylim(.1, 10000) + plt.ylim(.1, 100000) # Bar offset x_offset = -(bar_width/2)*(n - 1) @@ -75,13 +75,13 @@ def main(args): mae_a[i] += lmdk_bgt.mae_cons(seq, rls_data_a)/args.iter # Calculate once - # Event - if i == 0: - rls_data_evt, _ = lmdk_bgt.uniform_cons(seq, seq[seq[:, 1] < lmdks_th[0]], epsilon) + if pct == lmdks_pct[0]: + # Event + rls_data_evt, _ = lmdk_bgt.uniform_cons(seq, lmdks, epsilon) mae_evt += lmdk_bgt.mae_cons(seq, rls_data_evt)/args.iter - # User - if i == 0: - rls_data_usr, _ = lmdk_bgt.uniform_cons(seq, seq[seq[:, 1] < lmdks_th[len(lmdks_th)-1]], epsilon) + elif pct == lmdks_pct[-1]: + # User + rls_data_usr, _ = lmdk_bgt.uniform_cons(seq, lmdks, epsilon) mae_usr += lmdk_bgt.mae_cons(seq, rls_data_usr)/args.iter plt.axhline( diff --git a/code/expt/t-drive-sel.py b/code/expt/t-drive-sel.py index 1f1683c..a9ebdcf 100644 --- a/code/expt/t-drive-sel.py +++ b/code/expt/t-drive-sel.py @@ -70,7 +70,7 @@ def main(args): # The y axis plt.ylabel('Mean absolute error (m)') # Set y axis label. plt.yscale('log') - # plt.ylim(1, 100000000) + plt.ylim(1, 1000000) # Bar offset x_offset = -(bar_width/2)*(n - 1) @@ -101,12 +101,13 @@ def main(args): rls_data_a, _, _ = lmdk_bgt.adaptive(seq, lmdks, eps_out, .5, .5) mae_a[i] += lmdk_bgt.mae(seq, rls_data_a)/args.iter - # Event - if lmdk == 0: + # Calculate once + if lmdk == min(data_info[d]['lmdks']): + # Event rls_data_evt, _ = lmdk_bgt.uniform_r(seq, lmdks, bgt['epsilon']) mae_evt += lmdk_bgt.mae(seq, rls_data_evt)/args.iter - # User - if lmdk == 100: + elif lmdk == max(data_info[d]['lmdks']): + # User rls_data_usr, _ = lmdk_bgt.uniform_r(seq, lmdks, bgt['epsilon']) mae_usr += lmdk_bgt.mae(seq, rls_data_usr)/args.iter diff --git a/code/expt/t-drive.py b/code/expt/t-drive.py index 6c485a1..7c5f607 100644 --- a/code/expt/t-drive.py +++ b/code/expt/t-drive.py @@ -68,7 +68,7 @@ def main(args): # The y axis plt.ylabel('Mean absolute error (m)') # Set y axis label. plt.yscale('log') - # plt.ylim(1, 100000000) + plt.ylim(1, 1000000) # Bar offset x_offset = -(bar_width/2)*(n - 1) @@ -103,12 +103,13 @@ def main(args): # mae_d[i] += lmdk_bgt.mae(seq, rls_data_a)/args.iter # s_d += s_d_c/args.iter - # Event - if lmdk == 0: + # Calculate once + if lmdk == min(data_info[d]['lmdks']): + # Event rls_data_evt, _ = lmdk_bgt.uniform_r(seq, lmdks, bgt['epsilon']) mae_evt += lmdk_bgt.mae(seq, rls_data_evt)/args.iter - # User - if lmdk == 100: + elif lmdk == max(data_info[d]['lmdks']): + # User rls_data_usr, _ = lmdk_bgt.uniform_r(seq, lmdks, bgt['epsilon']) mae_usr += lmdk_bgt.mae(seq, rls_data_usr)/args.iter diff --git a/code/lib/lmdk_bgt.py b/code/lib/lmdk_bgt.py index f3e668f..66f575f 100644 --- a/code/lib/lmdk_bgt.py +++ b/code/lib/lmdk_bgt.py @@ -558,10 +558,10 @@ def skip_cont(seq, lmdks, epsilon): # Add noise o = lmdk_lib.randomized_response(is_landmark, bgts[i]) if is_landmark: + bgts[i] = 0 if i > 0: # Approximate with previous o = rls_data[i - 1][1] - bgts[i] = 0 rls_data[i] = [is_landmark, o] return rls_data, bgts diff --git a/rslt/bgt_cmp/T-drive-sel.pdf b/graphics/evaluation/copenhagen-sel.pdf similarity index 72% rename from rslt/bgt_cmp/T-drive-sel.pdf rename to graphics/evaluation/copenhagen-sel.pdf index 07bc388..5db4b5b 100644 Binary files a/rslt/bgt_cmp/T-drive-sel.pdf and b/graphics/evaluation/copenhagen-sel.pdf differ diff --git a/graphics/evaluation/hue-sel.pdf b/graphics/evaluation/hue-sel.pdf new file mode 100644 index 0000000..5f75788 Binary files /dev/null and b/graphics/evaluation/hue-sel.pdf differ diff --git a/graphics/evaluation/hue.pdf b/graphics/evaluation/hue.pdf index cc1dc1b..ba6926d 100644 Binary files a/graphics/evaluation/hue.pdf and b/graphics/evaluation/hue.pdf differ diff --git a/graphics/evaluation/lmdk-sel-dist-emd.pdf b/graphics/evaluation/lmdk-sel-dist-emd.pdf new file mode 100644 index 0000000..b49ce11 Binary files /dev/null and b/graphics/evaluation/lmdk-sel-dist-emd.pdf differ diff --git a/graphics/evaluation/lmdk-sel-dist-norm.pdf b/graphics/evaluation/lmdk-sel-dist-norm.pdf new file mode 100644 index 0000000..dddda0c Binary files /dev/null and b/graphics/evaluation/lmdk-sel-dist-norm.pdf differ diff --git a/rslt/bgt_cmp/T-drive.pdf b/graphics/evaluation/t-drive-sel.pdf similarity index 79% rename from rslt/bgt_cmp/T-drive.pdf rename to graphics/evaluation/t-drive-sel.pdf index c2df049..12636c9 100644 Binary files a/rslt/bgt_cmp/T-drive.pdf and b/graphics/evaluation/t-drive-sel.pdf differ diff --git a/graphics/evaluation/t-drive.pdf b/graphics/evaluation/t-drive.pdf index c2df049..40576dd 100644 Binary files a/graphics/evaluation/t-drive.pdf and b/graphics/evaluation/t-drive.pdf differ diff --git a/rslt/bgt_cmp/Copenhagen-sel.pdf b/rslt/bgt_cmp/Copenhagen-sel.pdf index 5db4b5b..b81c1c1 100644 Binary files a/rslt/bgt_cmp/Copenhagen-sel.pdf and b/rslt/bgt_cmp/Copenhagen-sel.pdf differ diff --git a/rslt/bgt_cmp/Copenhagen.pdf b/rslt/bgt_cmp/Copenhagen.pdf index b6788c5..f7d9faa 100644 Binary files a/rslt/bgt_cmp/Copenhagen.pdf and b/rslt/bgt_cmp/Copenhagen.pdf differ diff --git a/rslt/bgt_cmp/HUE-sel.pdf b/rslt/bgt_cmp/HUE-sel.pdf index 50e6241..5f75788 100644 Binary files a/rslt/bgt_cmp/HUE-sel.pdf and b/rslt/bgt_cmp/HUE-sel.pdf differ diff --git a/rslt/bgt_cmp/HUE.pdf b/rslt/bgt_cmp/HUE.pdf index cc1dc1b..ba6926d 100644 Binary files a/rslt/bgt_cmp/HUE.pdf and b/rslt/bgt_cmp/HUE.pdf differ