Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE REQUEST]: RangeParameter handling periodic variables (such as angles) #2763

Open
1 task done
EtorArza opened this issue Sep 12, 2024 · 2 comments
Open
1 task done
Assignees
Labels
enhancement New feature or request

Comments

@EtorArza
Copy link

EtorArza commented Sep 12, 2024

Motivation

Greetings,

I am using bayesian optimization with Ax for a project where we are trying to optimize the shape of flying drones. All of the parameters I am optimizing are continuous, but some of the parameters are angles. The range of these angle parameters is [0,2pi] where 0 an 2pi are equivalent. This also implies that going from 2pi - epsilon to 0+epsilon should be a small change of 2 epsilon, instead of a large change of 2pi - 2epsilon that it is currently.

As far as I understand, there is no way to account for this with the current implementation of Ax cannot account for this. Moreover, I am getting solutions like

0.000, 0.229, 0.255, 6.283, 6.258, 0.213, 0.532, 0.863, 0.63, 6.283, 0.750, 0.571, 0.342, 0.00, 0.352, 0.110, 0.647, 0.725

with many values close to 2pi and 0.0.

Describe the solution you'd like to see implemented in Ax.

It would be nice if Ax could take into account periodic variables like this, such that 0 and 2pi are the same instead of far away.

Describe any alternatives you've considered to the above solution.

Currently, a workaround I can think of is using the interval [-pi, 3pi] such that the whole range can be used in the optimization without any discontinuities. However, this is not ideal since it adds duplicate solutions. Note however, that the optimization is still working, even without this workaround, but this would be a nice enhancement.

Is this related to an existing issue in Ax or another repository? If so please include links to those Issues here.

I looked at the issues with Ax and I was not able to find anything similar to this. It might require changing the underlying BO Torch package used by Ax, but I am not knowledgeable enough to know that for sure.

Code of Conduct

  • I agree to follow Ax's Code of Conduct
@EtorArza EtorArza added the enhancement New feature or request label Sep 12, 2024
@Balandat
Copy link
Contributor

Thanks for raising this issue.

I am getting solutions [...] with many values close to 2pi and 0.0.

This is caused by the model having larger uncertainty at the "boundary" and I agree that this is suboptimal behavior.

As you said the proper way to do this would be to use a custom kernel that is periodic in the angle parameters in the underlying BoTorch model. We don't have out-of-the-box support for this right now, but it's something we could potentially consider in the longer term (this would involve some nontrivial engineering effort piping everything through properly).

cc @sdaulton who has used a custom setup for periodic contextual features in (non-OSS) Ax for any thoughts.

cc @mpolson64 re considerations for Parameter types

@Balandat
Copy link
Contributor

cc @SebastianAment

@danielcohenlive danielcohenlive self-assigned this Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants