-
Notifications
You must be signed in to change notification settings - Fork 1
/
ex_time_mc.py
132 lines (117 loc) · 4.02 KB
/
ex_time_mc.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
from api import API
from disaggregate import ADAE, DAE, Seq2Point, Seq2Seq, WindowGRU, RNN
import warnings
warnings.filterwarnings("ignore")
path = 'D:/workspace/nilm/data/redd_data.h5'
# path = 'D:/workspace/nilm/code/databank/redd_data.h5'
DEBUG = False
TEST = False
def generate_method(debug, test):
if debug:
method = {
'DAE': DAE({'save-model-path': 'DAE', 'pretrained-model-path': None, 'n_epochs': 1, 'batch_size': 256}),
# 'RNN': RNN({'save-model-path': 'RNN', 'pretrained-model-path': None, 'n_epochs': 1, 'batch_size': 256}),
# 'Seq2Point': Seq2Point({'save-model-path': 'Seq2Point', 'pretrained-model-path': None, 'n_epochs': 1, 'batch_size': 256}),
# 'Seq2Seq': Seq2Seq({'save-model-path': 'Seq2Seq', 'pretrained-model-path': None, 'n_epochs': 1, 'batch_size': 256}),
# 'GRU': WindowGRU({'save-model-path': 'GRU', 'pretrained-model-path': None, 'n_epochs': 1, 'batch_size': 256}),
}
else:
method = {
'DAE': DAE({'save-model-path': 'DAE', 'pretrained-model-path': None}),
'RNN': RNN({'save-model-path': 'RNN', 'pretrained-model-path': None}),
'Seq2Point': Seq2Point({'save-model-path': 'Seq2Point', 'pretrained-model-path': None}),
'Seq2Seq': Seq2Seq({'save-model-path': 'Seq2Seq', 'pretrained-model-path': None}),
'GRU': WindowGRU({'save-model-path': 'GRU', 'pretrained-model-path': None}),
}
if test:
method = {
'DAE': DAE({'save-model-path': 'DAE', 'pretrained-model-path': 'DAE', 'batch_size': 256}),
# 'RNN': RNN({'save-model-path': 'RNN', 'pretrained-model-path': 'RNN', 'batch_size': 256}),
# 'Seq2Point': Seq2Point(
# {'save-model-path': 'Seq2Point', 'pretrained-model-path': 'Seq2Point', 'batch_size': 256}),
# 'Seq2Seq': Seq2Seq({'save-model-path': 'Seq2Seq', 'pretrained-model-path': 'Seq2Seq', 'batch_size': 256}),
# 'GRU': WindowGRU({'save-model-path': 'GRU', 'pretrained-model-path': 'GRU', 'batch_size': 256}),
}
return method
time_config = {
'train': {
1: {
'start_time': '2011-04-18',
'end_time': '2011-05-07'
},
2: {
'start_time': '2011-04-17',
'end_time': '2011-04-25'
},
3: {
'start_time': '2011-04-16',
'end_time': '2011-04-27'
},
4: {
'start_time': '2011-04-16',
'end_time': '2011-05-22'
},
6: {
'start_time': '2011-04-16',
'end_time': '2011-06-09'
}
},
'test': {
1: {
'start_time': '2011-05-07',
'end_time': '2011-05-24'
},
2: {
'start_time': '2011-04-25',
'end_time': '2011-05-22'
},
3: {
'start_time': '2011-04-27',
'end_time': '2011-05-30'
},
4: {
'start_time': '2011-05-22',
'end_time': '2011-06-03'
},
6: {
'start_time': '2011-06-09',
'end_time': '2011-06-13'
}
}
}
method = generate_method(DEBUG, TEST)
ex_train_microwave = {
'power': {
'mains': ['apparent', 'active'],
'appliance': ['apparent', 'active']
},
'sample_rate': 6,
'appliances': ['microwave'],
'methods': method,
'isState': False,
'train': {
'datasets': {
'redd': {
'path': path,
'buildings': {
1: time_config['train'][1],
2: time_config['train'][2],
3: time_config['train'][3],
}
}
}
},
'test': {
'datasets': {
'redd': {
'path': path,
'buildings': {
1: time_config['test'][1],
# 2: time_config['test'][2],
# 3: time_config['test'][3],
}
}
},
},
}
API(ex_train_microwave)