botorch
botorch copied to clipboard
[Bug] optimize-acqf returning wrong dim of acquisition scores
🐛 Bug
optimize_acqf should return a tensor with shape q when sequential = False and return_best_only = True however it returns an a single value. Following the code down this seems consistent with the expected behaviour of get_candidates_scipy which expects to return a single value for a t_batch. The expectations seems to be inconsistent between the top level api and other functions.
To reproduce
** Code snippet to reproduce **
Reproducing this bug requires dummy data etc. beyond the scope of this bug report
** Stack trace/error message ** NA
Expected Behavior
I think the expected behaviour should be that of the top level api, i.e. returning a q-dim vector of scores.
System information
Please complete the following information:
- BoTorch version: 0.6.5
- GPyTorch Version: 1.8.0
- PyTorch Version: 1.12.0+cu102
- Computer OS: MacOS 12.5.1
Additional context
Apologies for not providing a reproducible code snippet but this would be many lines of code with the need for a large amount of dummy data. I suspect the bug may not occur for small test data sets that do not include batching. I think it may be the result of using reshape(-1) somewhere on tensors that may be batched or not. Unfortunately due to my own time constraints I do not have time to investigate this further. Thanks for the fantastic software and all your hard work supporting it! I has been massively enabling for us. 🙇
If I understand this issue correctly, this is not a bug. Note that the acquisition value of a q
-batch when doing joint optimization (sequential=False
) is indeed a joint value, that is, it can by definition not be split up into individual components for each of the q
candidate points.
Does this make sense?
Thanks for your swift response!
The documentation here suggests that the returned score is a q-dim vector, i.e. a score for each generated candidate. This would be very useful in our particular use case and in general for BO one would expect an acquisition function score for each item.
I can see how, from an implementation perspective, when calculating candidates value jointly it is more convenient to have a single value for a q-batch to choose the best set, however as a user I would still like the individual scores as these are useful in their own right.
The 'bug' would be the inconsistency in the documentation and possibly the behaviour depending on which documentation you take as correct.
The documentation here suggests that the returned score is a q-dim vector, i.e. a score for each generated candidate.
Not quite, this is what the documentation says:
a tensor of associated acquisition values. If sequential=False, this is a (num_restarts)-dim tensor of joint acquisition values (with explicit restart dimension if return_best_only=False). If sequential=True, this is a q-dim tensor of expected acquisition values conditional on having observed canidates 0,1,…,i-1.
So in the sequential=False
case this indeed is meant to return a single value which is consistent with the documentation.
I would still like the individual scores as these are useful in their own right.
The point is that if we do joint optimization there are no meaningful individual scores - we compute the joint value of a batch of q
candidates. There is no concept of "scores for individual candidates" If you want that then you should use sequential=True
.