Closed sangttruong closed 3 months ago
Thanks for flagging this. We'll have to look into this in a bit more detail. cc @SebastianAment for potential numerical issues with gradient computations.
That said, is there a specific reason you are using the GPDraw
class? This is a bit of a poor man's approach to drawing sample paths from GPs, we have a much better setup based on path-wise sampling: https://github.com/pytorch/botorch/blob/main/botorch/sampling/pathwise/posterior_samplers.py#L86-L107
It should generally be preferable to use that - please let us know if you run into any similar issues there.
Hi @sangttruong. We're deprecating the GPDraw
class and it will be removed in a future release. I'd also recommend following @Balandat's recommendation to use pathwise sampling instead. Closing this since we do not intend to investigate the issue further due to deprecation.
🐛 Bug
I'm trying to maximize f(x) with respect to x in 2D, where f ~ GP using the GPDraw function (i.e., 1 step in the Thompson sampling procedure). The gradient y = f(x) w.r.t x does not point toward the steepest descent direction. In addition, the gradient can sometimes change direction quite unexpectedly. This behavior is not observed when f is Ackley. I wonder if this is a code problem or a (numerical) issue with GP. Any guidance would be appreciated.
To reproduce
Code snippet to reproduce
Stack trace/error message The gradient does not point downhill. It changes the direction and magnitude quite rapidly. The particle does not seem to move with a gradient.
Expected Behavior
The gradient should point downhill. Below is the expected behavior when using the Ackley function. The particle moves uphill nicely with Adam, and the gradient behaves as expected.
System information
Please complete the following information:
Additional context
None