-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmake_least_squares_data.py
More file actions
44 lines (38 loc) · 1.53 KB
/
make_least_squares_data.py
File metadata and controls
44 lines (38 loc) · 1.53 KB
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
import signac
import os
from bo_methods_lib.bo_methods_lib.analyze_data import LS_Analysis
from bo_methods_lib.bo_methods_lib.GPBO_Class_fxns import simulator_helper_test_fxns
#Ignore warnings
import warnings
warnings.simplefilter("ignore", category=RuntimeWarning)
warnings.simplefilter("ignore", category=UserWarning)
warnings.simplefilter("ignore", category=DeprecationWarning)
#Set Stuff
meth_name_val_list = [1,2,3,4,5,6,7]
save_csv = True #Set to False if you don't want to save/resave csvs
save_figs = True
project = signac.get_project("GPBO_nonoise")
seed = 1
tot_runs = 1000
for val in [11, 17, 2, 3, 15, 14, 12, 13, 10, 1]:
criteria_dict = {
"cs_name_val": val,
"ep_enum_val": 1,
"gp_package": "gpflow",
"meth_name_val": {"$in": meth_name_val_list},
}
analyzer = LS_Analysis(criteria_dict, project, save_csv)
#Get Simulator Object
simulator = simulator_helper_test_fxns(val, 0, None, 1) #This is a dummy simulator object
#Get all least squares solutions
ls_analyzer = LS_Analysis(criteria_dict, project, save_csv, simulator=simulator)
local_mins = ls_analyzer.categ_min(tot_runs)
#Get best runs
ls_results = ls_analyzer.least_squares_analysis()
ls_results_sort = ls_results.sort_values(by=['Min Obj Cum.', 'Iter'], ascending=[True, True])
ls_runs = ls_results_sort.drop_duplicates(subset="Run", keep='first')
ls_best_path = os.path.join(
ls_analyzer.study_results_dir,
"ls_best_run.csv"
)
ls_analyzer.save_data(ls_runs, ls_best_path)