Example #1
0
random_seed = int(random_seed)
start = int(start)
stop = int(stop)

if static_use == "True":
    # Use non-zero value of penalty
    lambda_cv_range = [0, 0.001, 0.01, 0.1]
else:
    lambda_cv_range = [0]

A_store = pickle.load(
    open(
        os.path.expanduser(
            '~/git/scalable-nilm/aaai18/predictions/case-{}-graph_{}_{}_{}_{}_As.pkl'
            .format(case, source, constant_use, start, stop)), 'r'))
source_df, source_dfc, source_tensor, source_static = create_region_df_dfc_static(
    source, year, start, stop)
target_df, target_dfc, target_tensor, target_static = create_region_df_dfc_static(
    target, year, start, stop)

# # using cosine similarity to compute L
source_L = get_L(source_static)
target_L = get_L(target_static)

if setting == "transfer":
    name = "{}-{}-{}-{}".format(source, target, random_seed, train_percentage)
else:
    name = "{}-{}-{}".format(target, random_seed, train_percentage)

# Seasonal constant constraints
if constant_use == 'True':
    T_constant = np.ones(stop - start).reshape(-1, 1)
"""
Run all the code on HCDM

"""

import os
import sys
import pickle
import pandas as pd
from common import APPLIANCES_ORDER, compute_rmse_fraction, create_region_df_dfc_static
source, target, start, stop = sys.argv[1:]
start = int(start)
stop = int(stop)
year=2014

target_df, target_dfc, target_tensor, target_static = create_region_df_dfc_static(target, year, start, stop)
df = pd.DataFrame(target_static, index=target_df.index)
idx = df.dropna(how='any').index



out = {}
params = {}
for case in [2, 4]:
	out[case] = {}
	params[case] = {}
	for constant_use in ['True','False']:
		out[case][constant_use] = {}
		params[case][constant_use] = {}
		for static_use in ['True', 'False']:
			out[case][constant_use][static_use] = {}
Example #3
0
global source, source_df, source_dfc, source_tensor, source_static
global case
global T_constant
global start, stop
global source_L


appliance_index = {appliance: APPLIANCES_ORDER.index(appliance) for appliance in APPLIANCES_ORDER}
APPLIANCES = ['fridge', 'hvac', 'wm', 'mw', 'oven', 'dw']
year = 2014

case, source, constant_use, start, stop = sys.argv[1:]
case = int(case)
start = int(start)
stop = int(stop)
source_df, source_dfc, source_tensor, source_static = create_region_df_dfc_static(source, year, start, stop)

# # using cosine similarity to compute L
source_L = get_L(source_static)

# Seasonal constant constraints
if constant_use == 'True':
	T_constant = np.ones(stop-start).reshape(-1,1)
else:
	T_constant = None
# End

pred = {}
n_splits = 10

algo = 'adagrad'