From 3dd9913af614aab544ac3d4ddddb4ef3adb7db71 Mon Sep 17 00:00:00 2001 From: Manos Date: Wed, 29 Sep 2021 12:58:40 +0200 Subject: [PATCH] code: Ready to experiment --- code/expt/bgt_cmp_copenhagen.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/code/expt/bgt_cmp_copenhagen.py b/code/expt/bgt_cmp_copenhagen.py index 6ede6b6..cd9c0c4 100644 --- a/code/expt/bgt_cmp_copenhagen.py +++ b/code/expt/bgt_cmp_copenhagen.py @@ -59,18 +59,20 @@ def main(args): mae_a = np.zeros(len(lmdks_pct)) mae_evt = np.zeros(len(lmdks_pct)) mae_usr = np.zeros(len(lmdks_pct)) + for i, pct in enumerate(lmdks_pct): # Find landmarks - # lmdks = lmdk_lib.find_lmdks_tim(lmdk_data, seq, uid, pct) lmdks = lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, pct) for _ in range(args.iter): # Skip - rls_data_s, _ = lmdk_bgt.skip_cont(seq, lmdks, epsilon) + rls_data_s, bgts_s = lmdk_bgt.skip_cont(seq, lmdks, epsilon) + # lmdk_bgt.validate_bgts(seq, lmdks, epsilon, bgts_s) mae_s[i] += lmdk_bgt.mae_cont(rls_data_s)/args.iter # Uniform - rls_data_u, _ = lmdk_bgt.uniform_cont(seq, lmdks, epsilon) + rls_data_u, bgts_u = lmdk_bgt.uniform_cont(seq, lmdks, epsilon) + # lmdk_bgt.validate_bgts(seq, lmdks, epsilon, bgts_u) mae_u[i] += lmdk_bgt.mae_cont(rls_data_u)/args.iter # Adaptive @@ -78,10 +80,14 @@ def main(args): mae_a[i] += lmdk_bgt.mae_cont(rls_data_a)/args.iter # Event - rls_data_evt, _ = lmdk_bgt.uniform_cont(seq, lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, 0), epsilon) + # Calculate once + if i == 0: + rls_data_evt, _ = lmdk_bgt.uniform_cont(seq, lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, 0), epsilon) mae_evt[i] += lmdk_bgt.mae_cont(rls_data_evt)/args.iter # User - rls_data_usr, _ = lmdk_bgt.uniform_cont(seq, lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, 100), epsilon) + # Calculate once + if i == 0: + rls_data_usr, _ = lmdk_bgt.uniform_cont(seq, lmdk_lib.find_lmdks_cont(lmdk_data, seq, uid, 100), epsilon) mae_usr[i] += lmdk_bgt.mae_cont(rls_data_usr)/args.iter plt.plot( @@ -89,12 +95,14 @@ def main(args): mae_evt, linewidth=lmdk_lib.line_width ) + plt.text(x_i[-1], mae_evt[-1], ' event') plt.plot( x_i, mae_usr, linewidth=lmdk_lib.line_width ) + plt.text(x_i[-1], mae_usr[-1], ' user') plt.bar( x_i + x_offset, @@ -121,7 +129,7 @@ def main(args): ) x_offset += bar_width - path = str('rslt/bgt_cmp/' + d) + path = str('../../rslt/bgt_cmp/' + d) # Plot legend lmdk_lib.plot_legend() # # Show plot