forked from CraigGin/PDEKoopman
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Burgers_Experiment28pp_restore.py
52 lines (42 loc) · 1.1 KB
/
Burgers_Experiment28pp_restore.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
import pickle
import copy
import glob, os
import math
import training
def BestErrorFile(folder_name):
filename_best = ''
best_error = 10**6
current_dir = os.getcwd()
os.chdir(folder_name)
for file in glob.glob("*.pkl"):
with open(file, 'rb') as f:
params = pickle.load(f)
if not math.isnan(params['minRegTest']):
if params['minRegTest'] < best_error:
filename_best = file
best_error = params['minRegTest']
os.chdir(current_dir)
return filename_best
folder_name = './Burgers_exp28pp/'
file_name = BestErrorFile(folder_name)
if file_name == '':
print('No files have finite error')
quit()
else:
pkl_file = folder_name + file_name
with open(pkl_file, 'rb') as f:
params = pickle.load(f)
print(params['minRegTest'])
params['restore'] = 1
params['auto_first'] = 0
params['max_time'] = 12*60*60
params['min_5min'] = 10**2
params['min_20min'] = 10**1
params['min_40min'] = 5
params['min_1hr'] = 3
params['min_2hr'] = 2
params['min_3hr'] = 2
params['min_4hr'] = 2
params['min_halfway'] = 2
params['model_restore_path'] = params['model_path']
training.main_exp(copy.deepcopy(params))