Ejemplo n.º 1
0
                                       mean=mean)

max_power = params_appliance[application]['max_on_power']
threshold = params_appliance[application]['on_power_threshold']

ground_truth = ground_truth[offset:-offset] * std + mean
mains = (test_set_x[offset:-offset]) * std + mean

prediction = test_prediction[offset:-offset]
prediction[prediction <= 0.0] = 0.0
print(prediction.shape)
print(ground_truth.shape)
# np.save(args.appliance_name.replace(" ","_")+'_prediction', prediction)
# to load results: np.load(args.appliance_name+'_prediction')
sess.close()
sample_second = 6.0  # sample time is 6 seconds
print('F1:{0}'.format(
    nm.get_F1(ground_truth.flatten(), prediction.flatten(), threshold)))
print('NDE:{0}'.format(nm.get_nde(ground_truth.flatten(),
                                  prediction.flatten())))
print('MAE:{0}'.format(
    nm.get_abs_error(ground_truth.flatten(), prediction.flatten())))
print('SAE:{0}'.format(
    nm.get_sae(ground_truth.flatten(), prediction.flatten(), sample_second)))
save_name_y_pred = 'results/' + 'pointnet_building2_' + args.appliance_name + '_pred.npy'  #save path for mains
save_name_y_gt = 'results/' + 'pointnet_building2_' + args.appliance_name + '_gt.npy'  #save path for target
save_name_mains = 'results/' + 'pointnet_building2_' + args.appliance_name + '_mains.npy'  #save path for target
np.save(save_name_y_pred, prediction)
np.save(save_name_y_gt, ground_truth)
np.save(save_name_mains, mains)
Ejemplo n.º 2
0
max_power = params_appliance[args.appliance_name]['max_on_power']
threshold = params_appliance[args.appliance_name]['on_power_threshold']
aggregate_mean = 522
aggregate_std = 814


log('aggregate_mean: ' + str(aggregate_mean))
log('aggregate_std: ' + str(aggregate_std))


sess.close()


# ------------------------------------------ metric evaluation----------------------------------------------------------
sample_second = 8.0  # sample time is 8 seconds
log('F1:{0}'.format(nm.get_F1(ground_truth.flatten(), prediction.flatten(), threshold)))


# ----------------------------------------------- save results ---------------------------------------------------------
savemains = test_set_x.flatten() * aggregate_std + aggregate_mean
savegt = ground_truth
savepred = prediction.flatten()

if args.transfer:
    save_name = args.save_results_dir + '/' + appliance_name  # save path for mains
else:
    save_name = args.save_results_dir + '/' + appliance_name   # save path for mains
if not os.path.exists(save_name):
        os.makedirs(save_name)
# Numpy saving
np.save(save_name + '/pred.npy', savepred)