expt: Ready to run new experiments with HUE

This commit is contained in:
Manos Katsomallos 2021-10-01 18:40:46 +02:00
parent adf2f13b6a
commit 1870fa94a0
2 changed files with 15 additions and 12 deletions

View File

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

View File

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