File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 14
14
15
15
import numpy as np
16
16
import torch
17
+
17
18
from botorch .acquisition .acquisition import (
18
19
AcquisitionFunction ,
19
20
OneShotAcquisitionFunction ,
20
21
)
22
+ from botorch .acquisition .analytic import LogExpectedImprovement
21
23
from botorch .acquisition .knowledge_gradient import qKnowledgeGradient
22
24
from botorch .acquisition .monte_carlo import qExpectedImprovement
23
25
from botorch .acquisition .multi_objective .hypervolume_knowledge_gradient import (
@@ -1147,6 +1149,23 @@ def nlc(x):
1147
1149
),
1148
1150
)
1149
1151
1152
+ def test_optimize_acqf_all_fixed_features (self ):
1153
+ train_X = torch .rand (3 , 2 )
1154
+ train_Y = torch .rand (3 , 1 )
1155
+ gp = SingleTaskGP (train_X = train_X , train_Y = train_Y )
1156
+ gp .eval ()
1157
+ logEI = LogExpectedImprovement (model = gp , best_f = train_Y .max ())
1158
+ bounds = torch .stack ([torch .zeros (2 ), torch .ones (2 )])
1159
+ _ , acqf_value = optimize_acqf (
1160
+ logEI ,
1161
+ bounds ,
1162
+ q = 1 ,
1163
+ num_restarts = 1 ,
1164
+ raw_samples = 1 ,
1165
+ fixed_features = {0 : 0 , 1 : 0 },
1166
+ )
1167
+ self .assertEqual (acqf_value .ndim , 0 )
1168
+
1150
1169
def test_constraint_caching (self ):
1151
1170
def nlc (x ):
1152
1171
return 4 - x .sum (dim = - 1 )
You can’t perform that action at this time.
0 commit comments