-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_experiment_example.py
205 lines (185 loc) · 6.72 KB
/
run_experiment_example.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
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# @Time : Jul. 10, 2020 19:45
# @Author : Zhen Zhang
# @Email : [email protected]
# @FileName : run_experiment_example.py
# @Version : 1.0
# @IDE : VSCode
import Trier as trier
import os
expPath = "./experimentdir"
exp = trier.Experiment()
if os.path.exists(expPath+'/exp.json') == False:
exp.setup(path = expPath,
locations = {
"MelbCity" : {
"start" : "02/01/2017",
"end" : "02/28/2017",
"number" : 50, #park lots number
"random":True, #random training data
"randomParkingIDs":False, #random choose park lots id
"ParkingIDMetric":"median" #median, or mode
},
"Mornington" : {
"start" : "02/01/2020",
"end" : "02/28/2020",
"number" : 50,
"random":True,
"randomParkingIDs":False,
"ParkingIDMetric":"median"
}
},
medianSource = "MelbCity", #
baseUnit = 6, #time window number, 6 x5min
interval = 5, #time window, 5min
features = ['Temp', 'Wind', 'Humidity', 'Barometer', 'Extreme_weather','num_of_poi1.0', 'num_of_open_poi1.0','num_of_poi0.5', 'num_of_open_poi0.5','min_dis1.0', 'num_of_poi1.0', 'Hour','DayOfWeek', 'DayOfMonth','availability'],
reLoadExistDir = False)
# add experiments:
exp.add({
"model": "LSTM", #model name
"location": "Mornington", #location
"trainWithParkingData":False, # whether include parking data in train dataset,if include plz remove this line!
"parameters": {
# "batch_size": 100,
# "epochs": 4000,
# "hidden_size": 48,
# "learningRate": 0.000005,
# "monitor": "val_loss",
# "mode": "min",
# "nesterov": False,
# "loss": "mae",
# "verbose": 1
}
})
exp.add({
"model": "convLSTM",
"location": "Mornington",
"trainWithParkingData":False, # whether include parking data in train dataset
"parameters": { # add any parameters if need, see ./models/convLSTM.py
}
})
exp.add({
"model": "LSTM", #model name
"location": "MelbCity", #location
"trainWithParkingData":False, # whether include parking data in train dataset
"parameters": {# add any parameters if need, see ./models/LSTM.py
}
})
exp.add({
"model": "convLSTM",
"location": "MelbCity",
"trainWithParkingData":False, # whether include parking data in train dataset
"parameters": {
}
})
exp.add({
"model": "LSTM", #model name
"location": "Mornington", #location
"parameters": {
}
})
exp.add({
"model": "convLSTM",
"location": "Mornington",
"parameters": {
}
})
exp.add({
"model": "LSTM", #model name
"location": "MelbCity", #location
"parameters": {
}
})
exp.add({
"model": "convLSTM",
"location": "MelbCity",
"parameters": {
}
})
exp.add({
"model": "ADDA",
"source": "MelbCity",
"target": "Mornington",
"trainWithParkingData":False, # whether include parking data in train dataset, if include plz remove this line!
"parameters": { # add any parameters if need, see ./models/ADDA.py
"encoder": "MLP", # Normal ADDA
"batchSize": 10000,
"num_epochs": 100,
"num_epochs_pre": 100,
"d_learning_rate": 1e-05,
"c_learning_rate": 1e-05,
"e_input_dims": 90, # 6 * (0+15),
"e_hidden_dims": 45,
"e_output_dims": 24,
"r_input_dims": 24,
"d_input_dims": 24,
"d_hidden_dims": 12
}
})
exp.add({
"model": "ADDA",
"source": "MelbCity",
"target": "Mornington",
"parameters": {
"encoder": "MLP", # Normal ADDA
"batchSize": 10000,
"num_epochs": 100,
"num_epochs_pre": 100,
"d_learning_rate": 1e-05,
"c_learning_rate": 1e-05,
"e_input_dims": 96, # 6 * (1+15), 1 is parking data, 15: features number, 6 is time windows number, baseUnit
"e_hidden_dims": 48,
"e_output_dims": 24,
"r_input_dims": 24,
"d_input_dims": 24,
"d_hidden_dims": 12
}
})
exp.add({
"model": "ADDA",
"source": "MelbCity",
"target": "Mornington",
"trainWithParkingData":False, # whether include parking data in train dataset, if include plz remove this line!
"parameters": {
"encoder": "convLSTM", # ADDA with convLSTM
"batchSize": 32,
"num_epochs": 100,
"num_epochs_pre": 100,
"d_learning_rate": 1e-05,
"c_learning_rate": 1e-05,
"e_input_dims": 90, # 6 * (0+15),
"e_hidden_dims": 48,
"e_output_dims": 24,
"r_input_dims": 24,
"d_input_dims": 24,
"d_hidden_dims": 12
}
})
exp.add({
"model": "ADDA",
"source": "MelbCity",
"target": "Mornington",
"trainWithParkingData":False, # whether include parking data in train dataset, if include plz remove this line!
"parameters": {
"encoder": "convLSTM", # ADDA with convLSTM
"batchSize": 32,
"num_epochs": 100,
"num_epochs_pre": 100,
"d_learning_rate": 1e-05,
"c_learning_rate": 1e-05,
"e_input_dims": 90, # 6 * (0+15),
"e_hidden_dims": 48,
"e_output_dims": 24,
"r_input_dims": 24,
"d_input_dims": 24,
"d_hidden_dims": 12
}
})
#exp.showConfig()
exp.prepareTTDatasets() # generate datasets
exp.run() # run all experiments(no result only)
else:
exp.loadConfig(expPath+"/exp.json") # load experiment file
#exp.showConfig() # show all experiments configs
#exp.showFeatureList() # show all possible features
exp.run() # run all experiments(no result only)
#exp.run("2b39d340-b946-11ea-b691-0242ac110003") #run the experiment (UUID:2b39d340-b946-11ea-b691-0242ac110003)