-
Notifications
You must be signed in to change notification settings - Fork 457
Closed
Description
I am running into an issue with using ScalarizedPosteriorTransform with a multioutput GP. I am not doing anything fancy, just the following:
weights = torch.tensor(s / s.sum())
post_transf = ScalarizedPosteriorTransform(weights=weights)
mfacq = qMultiFidelityKnowledgeGradient(model=model, num_fantasies=32,
posterior_transform=post_transf,)
Then upon using it within the optimize_acqf call I see the following error:
---------------------------------------------------------------------------
UnsupportedError Traceback (most recent call last)
<ipython-input-10-52db2f5a269d> in <module>
27 return new_x
28
---> 29 optimize_acqf_(mfacq)
<ipython-input-10-52db2f5a269d> in optimize_acqf_(acqf, fixed_features)
7 _num_restarts = 10
8
----> 9 X_init = gen_one_shot_kg_initial_conditions(
10 acq_function=acqf,
11 bounds=bounds,
~/opt/anaconda3/lib/python3.8/site-packages/botorch/optim/initializers.py in gen_one_shot_kg_initial_conditions(acq_function, bounds, q, num_restarts, raw_samples, fixed_features, options, inequality_constraints, equality_constraints)
291
292 # compute maximizer of the value function
--> 293 value_function = _get_value_function(
294 model=acq_function.model,
295 objective=acq_function.objective,
~/opt/anaconda3/lib/python3.8/site-packages/botorch/acquisition/knowledge_gradient.py in _get_value_function(model, objective, posterior_transform, sampler, project, valfunc_cls, valfunc_argfac)
548 else:
549 print(posterior_transform)
--> 550 base_value_function = PosteriorMean(
551 model=model, posterior_transform=posterior_transform
552 )
~/opt/anaconda3/lib/python3.8/site-packages/botorch/acquisition/analytic.py in __init__(self, model, posterior_transform, maximize)
177 does actually return -1 * minimum of the posterior mean.
178 """
--> 179 super().__init__(model=model, posterior_transform=posterior_transform)
180 self.maximize = maximize
181
~/opt/anaconda3/lib/python3.8/site-packages/botorch/acquisition/analytic.py in __init__(self, model, posterior_transform, **kwargs)
53 if posterior_transform is None:
54 if model.num_outputs != 1:
---> 55 raise UnsupportedError(
56 "Must specify a posterior transform when using a "
57 "multi-output model."
UnsupportedError: Must specify a posterior transform when using a multi-output model.
Happy to provide full code if necessary. While it is clear that the PosteriorMean value function call within KnowledgeGradient sees None for the Posterior_transform, printing the attribute for debugging revealed that it becomes None only on the second call (the first call seems to be fine).
Can someone shed some light on this? thanks.
Metadata
Metadata
Assignees
Labels
No labels