-
Notifications
You must be signed in to change notification settings - Fork 1
/
ex1.py
159 lines (137 loc) · 4.65 KB
/
ex1.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
import warnings
from api import API
from disaggregate import ADAE, DAE, Seq2Point, Seq2Seq, WindowGRU, RNN, CNN_RNN
warnings.filterwarnings("ignore")
path = 'D:/workspace/nilm/code/databank/redd_data.h5'
debug = True
test = False
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'}),
'RNN': RNN({'save-model-path': 'RNN', 'pretrained-model-path': 'RNN'}),
'Seq2Point': Seq2Point({'save-model-path': 'Seq2Point', 'pretrained-model-path': 'Seq2Point'}),
'Seq2Seq': Seq2Seq({'save-model-path': 'Seq2Seq', 'pretrained-model-path': 'Seq2Seq'}),
'GRU': WindowGRU({'save-model-path': 'GRU', 'pretrained-model-path': 'GRU'}),
}
ex1 = {
'power': {
'mains': ['apparent', 'active'],
'appliance': ['apparent', 'active']
},
'sample_rate': 6,
'appliances': ['dish washer'],
'methods': method,
'isState': False,
'train': {
'datasets': {
'redd': {
'path': path,
'buildings': {
1: {
'start_time': '2011-04-18',
'end_time': '2011-05-24'
},
3: {
'start_time': '2011-04-16',
'end_time': '2011-05-30'
}
}
}
}
},
'test': {
'datasets': {
'redd': {
'path': path,
'buildings': {
2: {
'start_time': '2011-04-17',
'end_time': '2011-05-22'
},
4: {
'start_time': '2011-04-16',
'end_time': '2011-06-03'
}
}
}
},
},
}
test = False
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: {
'start_time': '2011-04-18',
'end_time': '2011-05-08'
},
2: {
'start_time': '2011-04-17',
'end_time': '2011-05-22'
},
3: {
'start_time': '2011-04-16',
'end_time': '2011-05-30'
},
# 4: {
# 'start_time': '2011-04-16',
# 'end_time': '2011-06-03'
# }
}
}
}
},
'test': {
'datasets': {
'redd': {
'path': path,
'buildings': {
1: {
'start_time': '2011-05-11',
'end_time': '2011-05-24'
},
2: {
'start_time': '2011-04-27',
'end_time': '2011-05-22'
},
3: {
'start_time': '2011-05-23',
'end_time': '2011-05-30'
},
# 4: {
# 'start_time': '2011-05-23',
# 'end_time': '2011-06-03'
# }
}
}
}
}
}
res = API(ex_train_microwave)