code: Ready to experiment

This commit is contained in:
Manos Katsomallos 2021-09-29 12:58:40 +02:00
parent 5eb60ab286
commit 3dd9913af6

View File

@ -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