-
Notifications
You must be signed in to change notification settings - Fork 0
/
runExperiments.py
587 lines (511 loc) · 21.1 KB
/
runExperiments.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
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
import pickle
import numpy as np
import pandas as pd
import geopandas as gpd
from methods.OLS import OLSRegression
from methods.MLPRegression import MLPRegression
from methods.GNN import runGNN
from methods.COREG import CoregTrainer
from methods.mean_teacher import *
from methods.label_propogation import runLabelProp
from pipeline.dataPreparation import getTrainingData, getMasks,constructAdjMx
from sklearn.preprocessing import StandardScaler
import time
import sys
import torch
#%% Static Parameters
#TODO: read in as yaml file
if len(sys.argv)>1:
device = sys.argv[1]
exp = sys.argv[2]
# Environment variables
shpFileLoc = 'Data/west_midlands_OAs/west_midlands_OAs.shp'
oaInfoLoc = 'Data/oa_info.csv'
labelledTripLoc = 'Data/labelled_sets/'
unLabelledTripLoc = 'Data/tripSets/'
dbLoc= 'Data/access.db'
resultsLoc = 'Data/results/'
poiLoc = 'Data/pois.csv'
featuresLoc = 'Data/features/'
print(device)
print(exp)
else:
device = 'cpu'
exp = 'exp5'
# Environment variables
shpFileLoc = 'E:/Data/west_midlands_OAs/west_midlands_OAs.shp'
oaInfoLoc = 'E:/Data/oa_info.csv'
labelledTripLoc = 'E:/Data/labelled_sets/'
unLabelledTripLoc = 'E:/Data/tripSets/'
dbLoc= 'E:/Data/access.db'
resultsLoc = 'E:/Data/results/'
poiLoc = 'E:/Data/pois.csv'
featuresLoc = 'E:/Data/features/'
#MLP
hiddenMLP1 = 2000
hiddenMLP2 = 1000
hiddenMLP3 = 500
hiddenMLP4 = 250
epochsMLP = 250
dpMLP = 0.2
#GNN
kGNN = 1
dpGNN = 0.2
hiddenGNN1 = 150
hiddenGNN2 = 100
hiddenGNNLinear1 = 75
hiddenGNNLinear2 = 50
epochsGNN = 150
#COREG
numTrialsCoreg = 1
k1Coreg = 1
k2Coreg = 1
p1Coreg = 2
p2Coreg = 2
maxItersCoreg = 25
poolSizeCoreg = 100
#%% Read in exp params
resultsDict = {}
paramsDict = {
'exp1':{
'area':'E08000025',
'poi':'School',
'stratum':'AM Peak',
'OAsReachableFile':'reachableOnFootBirm.csv',
'OAtoOABusFile':'OAtoOABusBirm.csv',
'unlabelledTripsFile':'trips_birm_School_amPeak.csv',
'lablledSetFile':'trips_birm_School_amPeak_results.csv',
'trainingDataFile':'birm_school_ampeak_training.txt',
'OBTreeFile':'OBTreeBirm.txt',
'urbanCentre':(52.47806970328915, -1.8989517979775046)
},
'exp2':{
'area':'E08000025',
'poi':'Hospital',
'stratum':'AM Peak',
'OAsReachableFile':'reachableOnFootBirm.csv',
'OAtoOABusFile':'OAtoOABusBirm.csv',
'unlabelledTripsFile':'trips_birm_Hospital_amPeak.csv',
'lablledSetFile':'trips_birm_Hospital_amPeak_results.csv',
'trainingDataFile':'birm_hospital_ampeak_training.txt',
'OBTreeFile':'OBTreeBirm.txt',
'urbanCentre':(52.47806970328915, -1.8989517979775046)
},
'exp3':{
'area':'E08000025',
'poi':'Vaccination Centre',
'stratum':'AM Peak',
'OAsReachableFile':'reachableOnFootBirm.csv',
'OAtoOABusFile':'OAtoOABusBirm.csv',
'unlabelledTripsFile':'trips_birm_Vaccination Centre_amPeak.csv',
'lablledSetFile':'trips_birm_Vaccination_Centre_amPeak_results.csv',
'trainingDataFile':'birm_vaccine_centre_ampeak_training.txt',
'OBTreeFile':'OBTreeBirm.txt',
'urbanCentre':(52.47806970328915, -1.8989517979775046)
},
'exp4':{
'area':'E08000025',
'poi':'Job Centre',
'stratum':'AM Peak',
'OAsReachableFile':'reachableOnFootBirm.csv',
'OAtoOABusFile':'OAtoOABusBirm.csv',
'unlabelledTripsFile':'trips_birm_Job Centre_amPeak.csv',
'lablledSetFile':'trips_birm_Job_Centre_amPeak_results.csv',
'trainingDataFile':'birm_job_centre_ampeak_training.txt',
'OBTreeFile':'OBTreeBirm.txt',
'urbanCentre':(52.47806970328915, -1.8989517979775046)
},
'exp5':{
'area':'E08000026',
'poi':'School',
'stratum':'AM Peak',
'OAsReachableFile':'reachableOnFootCov.csv',
'OAtoOABusFile':'OAtoOABusCov.csv',
'unlabelledTripsFile':'trips_cov_School_amPeak.csv',
'lablledSetFile':'trips_cov_School_amPeak_results.csv',
'trainingDataFile':'cov_school_ampeak_training.txt',
'OBTreeFile':'OBTreeCov.txt',
'urbanCentre':(52.4078358796818, -1.5137840014354358)
},
'exp6':{
'area':'E08000026',
'poi':'Hospital',
'stratum':'AM Peak',
'OAsReachableFile':'reachableOnFootCov.csv',
'OAtoOABusFile':'OAtoOABusCov.csv',
'unlabelledTripsFile':'trips_cov_Hospital_amPeak.csv',
'lablledSetFile':'trips_cov_Hospital_amPeak_results.csv',
'trainingDataFile':'cov_hospital_ampeak_training.txt',
'OBTreeFile':'OBTreeCov.txt',
'urbanCentre':(52.4078358796818, -1.5137840014354358)
},
'exp7':{
'area':'E08000026',
'poi':'Vaccination Centre',
'stratum':'AM Peak',
'OAsReachableFile':'reachableOnFootCov.csv',
'OAtoOABusFile':'OAtoOABusCov.csv',
'unlabelledTripsFile':'trips_cov_Vaccination Centre_amPeak.csv',
'lablledSetFile':'trips_cov_Vaccination_Centre_amPeak_results.csv',
'trainingDataFile':'cov_vaccine_centre_ampeak_training.txt',
'OBTreeFile':'OBTreeCov.txt',
'urbanCentre':(52.4078358796818, -1.5137840014354358)
},
'exp8':{
'area':'E08000026',
'poi':'Job Centre',
'stratum':'AM Peak',
'OAsReachableFile':'reachableOnFootCov.csv',
'OAtoOABusFile':'OAtoOABusCov.csv',
'unlabelledTripsFile':'trips_cov_Job Centre_amPeak.csv',
'lablledSetFile':'trips_cov_Job_Centre_amPeak_results.csv',
'trainingDataFile':'cov_job_centre_ampeak_training.txt',
'OBTreeFile':'OBTreeCov.txt',
'urbanCentre':(52.4078358796818, -1.5137840014354358)
},
'exp9':{
'area':'E08000025',
'poi':'School',
'stratum':'Inter Peak',
'OAsReachableFile':'reachableOnFootBirm.csv',
'OAtoOABusFile':'OAtoOABusBirm.csv',
'unlabelledTripsFile':'trips_birm_School_interPeak.csv',
'lablledSetFile':'trips_birm_School_interPeak_results.csv',
'trainingDataFile':'birm_school_interPeak_training.txt',
'OBTreeFile':'OBTreeBirm.txt',
'urbanCentre':(52.47806970328915, -1.8989517979775046)
},
'exp10':{
'area':'E08000025',
'poi':'Hospital',
'stratum':'Inter Peak',
'OAsReachableFile':'reachableOnFootBirm.csv',
'OAtoOABusFile':'OAtoOABusBirm.csv',
'unlabelledTripsFile':'trips_birm_Hospital_interPeak.csv',
'lablledSetFile':'trips_birm_Hospital_interPeak_results.csv',
'trainingDataFile':'birm_hospital_interPeak_training.txt',
'OBTreeFile':'OBTreeBirm.txt',
'urbanCentre':(52.47806970328915, -1.8989517979775046)
},
'exp11':{
'area':'E08000025',
'poi':'Vaccination Centre',
'stratum':'Inter Peak',
'OAsReachableFile':'reachableOnFootBirm.csv',
'OAtoOABusFile':'OAtoOABusBirm.csv',
'unlabelledTripsFile':'trips_birm_Vaccination Centre_interPeak.csv',
'lablledSetFile':'trips_birm_Vaccination_Centre_interPeak_results.csv',
'trainingDataFile':'birm_vaccine_centre_interPeak_training.txt',
'OBTreeFile':'OBTreeBirm.txt',
'urbanCentre':(52.47806970328915, -1.8989517979775046)
},
'exp12':{
'area':'E08000025',
'poi':'Job Centre',
'stratum':'Inter Peak',
'OAsReachableFile':'reachableOnFootBirm.csv',
'OAtoOABusFile':'OAtoOABusBirm.csv',
'unlabelledTripsFile':'trips_birm_Job Centre_interPeak.csv',
'lablledSetFile':'trips_birm_Job_Centre_interPeak_results.csv',
'trainingDataFile':'birm_job_centre_interPeak_training.txt',
'OBTreeFile':'OBTreeBirm.txt',
'urbanCentre':(52.47806970328915, -1.8989517979775046)
},
'exp13':{
'area':'E08000026',
'poi':'School',
'stratum':'Inter Peak',
'OAsReachableFile':'reachableOnFootCov.csv',
'OAtoOABusFile':'OAtoOABusCov.csv',
'unlabelledTripsFile':'trips_cov_School_interPeak.csv',
'lablledSetFile':'trips_cov_School_interPeak_results.csv',
'trainingDataFile':'cov_school_interPeak_training.txt',
'OBTreeFile':'OBTreeCov.txt',
'urbanCentre':(52.4078358796818, -1.5137840014354358)
},
'exp14':{
'area':'E08000026',
'poi':'Hospital',
'stratum':'Inter Peak',
'OAsReachableFile':'reachableOnFootCov.csv',
'OAtoOABusFile':'OAtoOABusCov.csv',
'unlabelledTripsFile':'trips_cov_Hospital_interPeak.csv',
'lablledSetFile':'trips_cov_Hospital_interPeak_results.csv',
'trainingDataFile':'cov_hospital_interPeak_training.txt',
'OBTreeFile':'OBTreeCov.txt',
'urbanCentre':(52.4078358796818, -1.5137840014354358)
},
'exp15':{
'area':'E08000026',
'poi':'Vaccination Centre',
'stratum':'Inter Peak',
'OAsReachableFile':'reachableOnFootCov.csv',
'OAtoOABusFile':'OAtoOABusCov.csv',
'unlabelledTripsFile':'trips_cov_Vaccination Centre_interPeak.csv',
'lablledSetFile':'trips_cov_Vaccination_Centre_interPeak_results.csv',
'trainingDataFile':'cov_vaccine_centre_interPeak_training.txt',
'OBTreeFile':'OBTreeCov.txt',
'urbanCentre':(52.4078358796818, -1.5137840014354358)
},
'exp16':{
'area':'E08000026',
'poi':'Job Centre',
'stratum':'Inter Peak',
'OAsReachableFile':'reachableOnFootCov.csv',
'OAtoOABusFile':'OAtoOABusCov.csv',
'unlabelledTripsFile':'trips_cov_Job Centre_interPeak.csv',
'lablledSetFile':'trips_cov_Job_Centre_interPeak_results.csv',
'trainingDataFile':'cov_job_centre_interPeak_training.txt',
'OBTreeFile':'OBTreeCov.txt',
'urbanCentre':(52.4078358796818, -1.5137840014354358)
}
}
params = paramsDict[exp]
boxBuffer = 0.38
intersectionThshHld = 0.15
walkableMins = 6
pcntNbrs = 0.025
vb = 0.3
budgets = [0.025,0.05,0.1,0.3,0.2,0.1,0.07,0.05,0.03]
level = 'O'
#%%
#Read in base datasets
# Read in base data - shapefile / OA info / OA index
wm_oas = gpd.read_file(shpFileLoc)
wm_oas = wm_oas[wm_oas['LAD11CD'] == params['area']]
oa_info = pd.read_csv(oaInfoLoc)
oa_info = oa_info.merge(wm_oas[['OA11CD']], left_on = 'oa_id', right_on = 'OA11CD', how = 'inner')
#oaLatLons - dictionary associating oa to lat/lons
oaLatLons=dict([(i,[a,b]) for i, a,b in zip(oa_info['oa_id'],oa_info['oa_lat'],oa_info['oa_lon'])])
poi = pd.read_csv(poiLoc, index_col = 0)
poi = poi[poi['type'] == params['poi']]
#%%
t0 = time.time()
trainingDataDict = getTrainingData(params,poi,unLabelledTripLoc,labelledTripLoc,wm_oas,oaLatLons,walkableMins,oa_info,boxBuffer,False,featuresLoc)
t1 = time.time()
resultsDict[exp] = {
'featureExtractionTime': t1 - t0
}
#%%
#for level in levels:
#Standardise data and split into x and y
scalerX = StandardScaler()
x = scalerX.fit_transform(trainingDataDict[level]['features'])
scalerY = StandardScaler()
y = scalerY.fit_transform(trainingDataDict[level]['labels'])
# Create adjacency matrix
edgeIndexNp, edgeWeightsNp = constructAdjMx(trainingDataDict,level,oaLatLons,pcntNbrs)
resultsDict[exp][level] = {
'scalerX':scalerX,
'scalerY':scalerY,
'yAct':y,
'index':trainingDataDict[level]['index'],
'weights':trainingDataDict[level]['weights'],
'labellingCosts':trainingDataDict[level]['labelcosts']
}
for b in budgets:
print('---- Next Experiment -----')
print('Level : ' + str(level))
print('Budget : ' + str(b))
testMask, trainMask, valMask = getMasks(b,vb,x)
resultsDict[exp][level][b] = {
'testMask':testMask,
'trainMask':trainMask,
'valMask':valMask
}
labeledMask = trainMask + valMask
unlabeledMask = testMask
print('Starting OLS Regression')
method = 'OLSRegression'
resultsDict[exp][level][b][method] = {}
yPred = np.zeros(y[testMask].shape)
infTimes = []
for i in range(4):
predVector, infTime = OLSRegression(x,y[:,i],trainMask,testMask)
yPred[:,i] = predVector
infTimes.append(infTime)
resultsDict[exp][level][b][method]['yPred'] = yPred
resultsDict[exp][level][b][method]['inference times'] = infTimes
print('Starting MLP Regression')
method = 'MLPRegression'
resultsDict[exp][level][b][method] = {}
yPred = np.zeros(y[testMask].shape)
infTimes = []
for i in range(4):
predVector, infTime, losses, lossesVal = MLPRegression(x,y[:,i],trainMask,testMask,valMask,1000, 500, 250, 100,epochsMLP, device,dpMLP)
yPred[:,i] = predVector
infTimes.append(infTime)
torch.cuda.empty_cache()
resultsDict[exp][level][b][method]['yPred'] = yPred
resultsDict[exp][level][b][method]['inference times'] = infTimes
# edgeIndexNp = np.load('Data/adjMx/' + str(expParams['area']) + '/'+str(expParams['p'])+'-o-walk-edgeList.npy')
# edgeWeightsNp = np.load('Data/adjMx/' + str(expParams['area']) + '/'+str(expParams['p'])+'-o-walk-edgeWeight.npy')
print('Starting GNN')
method = 'GNN'
resultsDict[exp][level][b][method] = {}
yPred = np.zeros(y[testMask].shape)
infTimes = []
for i in range(4):
print(i)
predVector,infTime,losses,lossesVal,lossesTest = runGNN(x,y[:,i],device,edgeIndexNp,edgeWeightsNp,hiddenGNN1,hiddenGNN2,hiddenGNNLinear1,hiddenGNNLinear2,epochsGNN,trainMask,testMask,valMask,kGNN, dpGNN)
yPred[:,i] = predVector
infTimes.append(infTime)
torch.cuda.empty_cache()
resultsDict[exp][level][b][method]['yPred'] = yPred
resultsDict[exp][level][b][method]['inference times'] = infTimes
print('Starting COREG')
method = 'COREG'
resultsDict[exp][level][b][method] = {}
yPred = np.zeros(y[testMask].shape)
infTimes = []
for i in range(4):
t0 = time.time()
coregTrainer = CoregTrainer(numTrialsCoreg,x,y[:,i],trainMask,testMask, k1=k1Coreg, k2=k2Coreg, p1=p1Coreg, p2=p2Coreg, max_iters=maxItersCoreg, pool_size=poolSizeCoreg, verbose=False)
coregTrainer.run_trials()
yPred[:,i] = coregTrainer.test_hat.squeeze()
t1 = time.time()
infTimes.append(t1 - t0)
resultsDict[exp][level][b][method]['yPred'] = yPred
resultsDict[exp][level][b][method]['inference times'] = infTimes
print('Starting Mean Teacher')
method = 'Mean Teacher'
resultsDict[exp][level][b][method] = {}
yPred = np.zeros(y[testMask].shape)
infTimes = []
for i in range(4):
t0 = time.time()
test_loss, best_val_loss, predVector = optimize_mean_teacher(x,y[:,i],testMask,valMask,labeledMask,unlabeledMask)
yPred[:,i] = predVector.squeeze()
t1 = time.time()
infTimes.append(t1 - t0)
resultsDict[exp][level][b][method]['yPred'] = yPred
resultsDict[exp][level][b][method]['inference times'] = infTimes
# print('Starting Label Prop')
# method = 'Label Propogation'
# resultsDict[exp][level][b][method] = {}
# yPred = np.zeros(y[testMask].shape)
# infTimes = []
# for i in range(4):
# print(i)
# t0 = time.time()
# predVector = runLabelProp(x,y[:,i],testMask,valMask,trainMask,labeledMask,unlabeledMask)
# yPred[:,i] = predVector
# t1 = time.time()
# print(t1 - t0)
# infTimes.append(t1 - t0)
# resultsDict[exp][level][b][method]['yAct'] = y
# resultsDict[exp][level][b][method]['yPred'] = yPred
# resultsDict[exp][level][b][method]['inference times'] = infTimes
f = open(resultsLoc + str(exp) + '.txt', 'wb')
pickle.dump(resultsDict,f)
f.close()
#%% For an experiment
# for expNum in allExpParams.keys():
# print('Experiment Number : ' + str(expNum))
# dataDir = 'Data/test_data/'+str(expNum)
# expParams = allExpParams[expNum]
# # Read in data
# x = np.load(dataDir+'/x.npy')
# y = np.load(dataDir+'/y.npy')
# yAct = np.load(dataDir+'/yAct.npy')
# trainMask = np.load(dataDir+'/trainMask.npy')
# testMask = np.load(dataDir+'/testMask.npy')
# valMask = np.load(dataDir+'/valMask.npy')
# labeledMask = np.load(dataDir+'/labeledMask.npy')
# unlabeledMask = np.load(dataDir+'/unlabeledMask.npy')
# oaIndex = pd.read_csv(dataDir+'/oa_index.csv', index_col = 0)
# OPPairs = pd.read_csv(dataDir+'/OPPairs.csv', index_col = 0)
# f = open(dataDir+'/scalerX.txt', 'rb')
# scalerX = pickle.load(f)
# f.close()
# f = open(dataDir+'/scalerY.txt', 'rb')
# scalerY = pickle.load(f)
# f.close()
# oa_info = oa_info_master.merge(oaIndex, left_on = 'oa_id', right_on = 'oa_id', how='inner')
# wm_oas = wm_oas_master.merge(oaIndex, left_on = 'OA11CD', right_on = 'oa_id', how='inner')
# #%Run methods
# #OLS
# predVector, infTime = OLSRegression(x,y,trainMask,testMask)
# for k,v in dGroups.items():
# modelResults = evaluateModel(testMask,scalerY,predVector,y,yAct,OPPairs,oa_info,v,wm_oas,mapResults=False)
# modelResults.update(expParams)
# modelResults['demo group'] = k
# modelResults['method'] = 'OLS'
# modelResults['infTime'] = infTime
# allResults.append(modelResults)
# allResultsPD = pd.DataFrame(allResults)
# allResultsPD.to_csv('results.csv')
# #MLP
# predVector, infTime, losses, lossesVal = MLPRegression(x,y,trainMask,testMask,valMask,1000, 500, 250, 100,epochsMLP, device,dpMLP)
# for k,v in dGroups.items():
# modelResults = evaluateModel(testMask,scalerY,predVector,y,yAct,OPPairs,oa_info,v,wm_oas,mapResults=False)
# modelResults.update(expParams)
# modelResults['demo group'] = k
# modelResults['method'] = 'MLP'
# modelResults['infTime'] = infTime
# allResults.append(modelResults)
# allResultsPD = pd.DataFrame(allResults)
# allResultsPD.to_csv('results.csv')
# #GNN - adj mx walk
# #Load Euclide Matrix
# edgeIndexNp = np.load('Data/adjMx/' + str(expParams['area']) + '/'+str(expParams['p'])+'-o-walk-edgeList.npy')
# edgeWeightsNp = np.load('Data/adjMx/' + str(expParams['area']) + '/'+str(expParams['p'])+'-o-walk-edgeWeight.npy')
# predVector,infTime,losses,lossesVal,lossesTest = runGNN(x,y,device,edgeIndexNp,edgeWeightsNp,hiddenGNN1,hiddenGNN2,hiddenGNNLinear1,hiddenGNNLinear2,epochsGNN,trainMask,testMask,valMask,kGNN, dpGNN)
# for k,v in dGroups.items():
# modelResults = evaluateModel(testMask,scalerY,predVector,y,yAct,OPPairs,oa_info,v,wm_oas,mapResults=False)
# modelResults.update(expParams)
# modelResults['demo group'] = k
# modelResults['method'] = 'GNN - Walk Matrix'
# modelResults['infTime'] = infTime
# allResults.append(modelResults)
# allResultsPD = pd.DataFrame(allResults)
# allResultsPD.to_csv('results.csv')
# #GNN - adj mx euclid
# #TBC - contingent on GNN optimisation
# #GNN - adj mx midway distance
# #TBC - contingent on ajd mx generation
# #GNN - adj mx midway distance weighted
# #TBC - contingent on ajd mx generation
# # COREG
# t0 = time.time()
# coregTrainer = CoregTrainer(numTrialsCoreg,x,y,trainMask,testMask, k1=k1Coreg,k2=k2Coreg, p1=p1Coreg, p2=p2Coreg, max_iters=maxItersCoreg, pool_size=poolSizeCoreg, verbose=False)
# coregTrainer.run_trials()
# predVector = coregTrainer.test_hat
# t1 = time.time()
# for k,v in dGroups.items():
# modelResults = evaluateModel(testMask,scalerY,predVector,y,yAct,OPPairs,oa_info,v,wm_oas,mapResults=False)
# modelResults.update(expParams)
# modelResults['demo group'] = k
# modelResults['method'] = 'COREG'
# modelResults['infTime'] = t1 - t0
# allResults.append(modelResults)
# allResultsPD = pd.DataFrame(allResults)
# allResultsPD.to_csv('results.csv')
# # Mean Teacher
# t0 = time.time()
# test_loss, best_val_loss, predVector = optimize_mean_teacher(x,y,testMask,valMask,labeledMask,unlabeledMask)
# t1 = time.time()
# for k,v in dGroups.items():
# modelResults = evaluateModel(testMask,scalerY,predVector,y,yAct,OPPairs,oa_info,v,wm_oas,mapResults=False)
# modelResults.update(expParams)
# modelResults['demo group'] = k
# modelResults['method'] = 'Mean Teacher'
# modelResults['infTime'] = t1 - t0
# allResults.append(modelResults)
# allResultsPD = pd.DataFrame(allResults)
# allResultsPD.to_csv('results.csv')
# #Label Propogation
# t0 = time.time()
# predVector = runLabelProp(x,y,testMask,valMask,trainMask,labeledMask,unlabeledMask)
# t1 = time.time()
# for k,v in dGroups.items():
# modelResults = evaluateModel(testMask,scalerY,predVector,y,yAct,OPPairs,oa_info,v,wm_oas,mapResults=False)
# modelResults.update(expParams)
# modelResults['demo group'] = k
# modelResults['method'] = 'Label Propogation'
# modelResults['infTime'] = t1 - t0
# allResults.append(modelResults)
# allResultsPD = pd.DataFrame(allResults)
# allResultsPD.to_csv('results.csv')
# #SSDKL
# #TBC