botorch icon indicating copy to clipboard operation
botorch copied to clipboard

gen_candidates_scipy handling of more than 3 dimensions.

Open SamuelGabriel opened this issue 6 months ago • 2 comments

What happened?

Our code currently passes more than three dimensions in two to gen_candidates_scipy in multiple places, which is not supported according to the doc string, but somehow _works.

These two functions do it, but maybe there are more:

  • botorch.acquisition.knowledege_gradient.qKnowledgeGradient.evaluate
  • botorch.utils.sampling.optimize_posterior_samples

I think we should get rid of these types of calls as, at least to me, it is very unclear what users expect of gen_candidates_scipy in these cases, as it is now changed to handle batching properly: so it is soon no more optimizing across all of the initial conditions at once.

Please provide a minimal, reproducible example of the unexpected behavior.

Please paste any relevant traceback/logs produced by the example provided.

-

BoTorch Version

main

Python Version

No response

Operating System

No response

(Optional) Describe any potential fixes you've considered to the issue outlined above.

No response

Pull Request

None

Code of Conduct

  • [x] I agree to follow BoTorch's Code of Conduct

SamuelGabriel avatar Jun 12 '25 19:06 SamuelGabriel

Can you provide examples of this/code pointers to what is inconsistent?

sdaulton avatar Jun 12 '25 19:06 sdaulton

The weird usages are usages with more than three dimension in the initial conditions. They are inside the functions listed above. You can quickly try it out by printing the shape of the initial conditions before the gen_candidates_scipy call in them, e.g. when running this test: botorch.acquisition.knowledge_gradient.qKnowledgeGradient.test_evaluate_kg.

SamuelGabriel avatar Jun 12 '25 20:06 SamuelGabriel