-
Notifications
You must be signed in to change notification settings - Fork 259
RandomDesign has a bug when there is a variable after a bandit variable #319
Comments
Looks reasonable. To confirm, can you create a clear unit test that fails with current code, and that your implementation fixes? |
Here's a simple test case:
With the current implementation, the last entry is never replaced from the I'm not sure exactly how to incorporate this into the test suite. If you want to take this from here, I'd appreciate it. |
If you submit a PR @samath117 I'd try my hand at it, fwiw. |
@samath117 to add it to the existing tests, just follow the pattern! Go to https://github.com/SheffieldML/GPyOpt/blob/master/GPyOpt/testing/util_tests/test_general_utils.py and add a new test there - should look very similar to existing methods in this class. Run the tests and make sure it fails as expected. Then implement the fix, run the tests again and make sure the test is green now. That's it, push and submit a PR. |
Unfortunately, this actually isn't the only issue with using a bandit variable with any other variables. In the
The problem is that these Is it safe to say that GPyOpt was never tested on a problem with a bandit variable and at least one other variable? |
Take a look at this definition in RandomDesign:
This function fills in random values for the discrete variables, simply sampling them. It aims to place them at the appropriate indices for those variables,
idx
orbandit_idx
, the first element of which iterates along with the variables. However, bandit variables take up multiple indices, soidx
lags behind and paints over the values of bandit variables after the first index. This causes it to fail whenever there is a bandit variable that isn't the last variable in the list.Here is the fix:
Instead of iterating
idx
with enumerate, we handle the iteration manually, making sure to take into account the dimensions taken up by bandit variables.Should I submit a PR?
The text was updated successfully, but these errors were encountered: