-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_ca1_hybrid.py
More file actions
75 lines (70 loc) · 3.52 KB
/
_ca1_hybrid.py
File metadata and controls
75 lines (70 loc) · 3.52 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
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
import os
from machinable import Interface, get
class _Ca1Hybrid(Interface):
def populations(self):
return ["BS"]
def launch(self):
from models.ops import import_initial_samples
for nm in self.populations():
for trial in range(1):
with get("machinable.scope", {"trial": trial}):
initial = get(
"interface.sopt_modeling",
[
f"""~from_protocol("benchmarks/ca1_pinsky_rinzel_modeling/config/CA1_{nm}.yaml")""",
{
"dopt_params.surrogate_method_name": "gpr",
"dopt_params.n_epochs": 0,
},
],
).launch()
initial.save_attribute("preflight", True)
if initial.cached():
vv = [{}]
for mode in ["o", "c+o"]:
for target in [
"objective distance",
"objective",
"-objective",
"-objective distance",
"distance",
]:
vv.append(
{
"dopt_params": {
"surrogate_custom_training": "models.ops.joint",
"surrogate_custom_training_kwargs": {
"mode": mode,
"objectives": False,
"feasibility_solving": True,
"feasibility_targets": target,
},
}
}
)
for version in vv:
with get("machinable.scope", {"parent": initial.hash}):
e = get(
[
"interface.sopt_modeling",
f"""~from_protocol("benchmarks/ca1_pinsky_rinzel_modeling/config/CA1_{nm}.yaml")""",
],
[version]
+ [
{
"dopt_params.n_epochs": 10,
}
],
).launch()
if os.environ.get("LAUNCH", 0) and not os.path.isfile(
e.output_filepath
):
e.commit()
import_initial_samples(
file_path=e.output_filepath,
source=initial.output_filepath,
num=e.num_initial_samples,
opt_id=e.config.dopt_params.opt_id,
feature_dtypes=e.feature_dtypes,
param_names=e.parameter_names,
)