From 1870fa94a0e6458f545027c7c8379e700032e697 Mon Sep 17 00:00:00 2001 From: Manos Katsomallos Date: Fri, 1 Oct 2021 18:40:46 +0200 Subject: [PATCH] expt: Ready to run new experiments with HUE --- code/expt/bgt_cmp_hue.py | 12 +++++++----- code/parse_hue.py | 15 ++++++++------- 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/code/expt/bgt_cmp_hue.py b/code/expt/bgt_cmp_hue.py index 5e3859d..788232a 100644 --- a/code/expt/bgt_cmp_hue.py +++ b/code/expt/bgt_cmp_hue.py @@ -23,7 +23,7 @@ def main(args): # The landmarks percentages lmdks_pct = [0, 20, 40, 60, 80, 100] # Landmarks' thresholds - lmdks_th = [0, .13, .15, .23, .3, 10] + lmdks_th = [0, .54, .68, .88, 1.12, 10] # The privacy budget epsilon = 1.0 @@ -45,8 +45,8 @@ def main(args): plt.xlim(x_i.min() - x_margin, x_i.max() + x_margin) # The y axis plt.ylabel('Mean absolute error (kWh)') # Set y axis label. - # plt.yscale('log') - # plt.ylim(0, 8) + plt.yscale('log') + plt.ylim(.1, 10000) # Bar offset x_offset = -(bar_width/2)*(n - 1) @@ -86,15 +86,17 @@ def main(args): plt.axhline( y = mae_evt, + color = '#212121', linewidth=lmdk_lib.line_width ) - plt.text(x_i[-1], mae_evt, ' event') + plt.text(x_i[-1] + x_i[-1]*.14, mae_evt - mae_evt*.14, 'event') plt.axhline( y = mae_usr, + color = '#616161', linewidth=lmdk_lib.line_width ) - plt.text(x_i[-1], mae_usr, ' user') + plt.text(x_i[-1] + x_i[-1]*.14, mae_usr - mae_usr*.14, 'user') plt.bar( x_i + x_offset, diff --git a/code/parse_hue.py b/code/parse_hue.py index 5f237a8..612d4fb 100644 --- a/code/parse_hue.py +++ b/code/parse_hue.py @@ -59,14 +59,15 @@ def main(args): print('[Error: %s]' %(e)) except Exception as e: print('[Error: %s]' %(e)) - # Save to results - lmdk_lib.save_data(args, np.array(cons, np.float32), 'cons') + # Save the first 1000 rows to the results + cons_data = np.array(cons, np.float32)[:1000] + lmdk_lib.save_data(args, cons_data, 'cons') ''' Find thresholds for goals. - 0.2: 0.30 - 0.4: 0.23 - 0.6: 0.15 - 0.8: 0.13 + 0.2: 1.12 + 0.4: 0.88 + 0.6: 0.68 + 0.8: 0.54 ''' # {goal: theta} lmdk = {} @@ -110,7 +111,7 @@ def parse_args(): # Optional arguments. parser.add_argument('-a', '--arc', help='The data archive file.', type=str, default='/home/manos/Cloud/Data/HUE/Data.zip') - parser.add_argument('-d', '--dat', help='The consumption data file.', type=str, default='Residential_26.csv') + parser.add_argument('-d', '--dat', help='The consumption data file.', type=str, default='Residential_1.csv') parser.add_argument('-r', '--res', help='The results archive file.', type=str, default='/home/manos/Cloud/Data/HUE/Results.zip') # Parse arguments.