Gpyopt: type Categorical crashes if domain starts with anything bigger than 0

Created on 22 Dec 2017  Â·  9Comments  Â·  Source: SheffieldML/GPyOpt

I am currently running an optimization that needs about 2 hours per run and has a lot of dimensions.
To reduce the time spent i started to decrease the parameter space.

this works fine:

{'name': 'windowSelector', 'type': 'categorical', 'domain': np.arange(0,10)}

while this causes an error:

{'name': 'windowSelector', 'type': 'categorical', 'domain': np.arange(1,10)}

Traceback (most recent call last):
File "optimizer.py", line 159, in
x_next = myBopt.suggest_next_locations(pending_X = pending)
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/bo.py", line 62, in suggest_next_locations
self._update_model(self.normalization_type)
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/bo.py", line 235, in _update_model
X_inmodel = self.space.unzip_inputs(self.X)
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/task/space.py", line 217, in unzip_inputs
Z.append(self.objective_to_model(X[k,:][None,:]))
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/task/space.py", line 206, in objective_to_model
new_entry = variable.objective_to_model(x_objective[0,k])
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/task/variables.py", line 152, in objective_to_model
entry[int(x_objective)] = 1
IndexError: list assignment index out of range

Most helpful comment

This was never addressed. At the moment categorial variables still have to be passed by index. Unfortunately the best answer I have right now is that if someone is bothered enough to create a PR to fix it, we'll happily merge it in.

At the very least let's reopen this. I think it was closed because it is behavior by design. Very poor design, admittedly.

All 9 comments

Hi,
We are aware of this issue. The reason why it fails is because categories
are passed by indexes which is what you define in the domain. For the
moment you need to adapt the objective to deal with the domain starting in
zero but we are working in this to make it more intuitive for the user.

El 22/12/2017 14:14, "theudas" notifications@github.com escribió:

I am currently running an optimization that needs about 2 hours per run
and has a lot of dimensions.
To reduce the time spent i started to decrease the parameter space.

this works fine:

{'name': 'windowSelector', 'type': 'categorical', 'domain': np.arange(0,10)}

while this causes an error:

{'name': 'windowSelector', 'type': 'categorical', 'domain': np.arange(1,10)}

Traceback (most recent call last):
File "optimizer.py", line 159, in
x_next = myBopt.suggest_next_locations(pending_X = pending)
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/bo.py",
line 62, in suggest_next_locations
self._update_model(self.normalization_type)
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/bo.py",
line 235, in _update_model
X_inmodel = self.space.unzip_inputs(self.X)
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/task/space.py",
line 217, in unzip_inputs
Z.append(self.objective_to_model(X[k,:][None,:]))
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/GPyOpt/core/task/space.py",
line 206, in objective_to_model
new_entry = variable.objective_to_model(x_objective[0,k])
File "/home/ps114900/anaconda3/lib/python3.6/site-packages/
GPyOpt/core/task/variables.py", line 152, in objective_to_model
entry[int(x_objective)] = 1
IndexError: list assignment index out of range

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/SheffieldML/GPyOpt/issues/139, or mute the thread
https://github.com/notifications/unsubscribe-auth/AGiS81QIdb9zB5YlTW1lrmO_HLQwVJ2bks5tC6s2gaJpZM4RLBrj
.

can i use a constraint to ignore index 0?
It turned out, that the value 0 window form always produces bad results.

The index that you use should matter as soon as you update the objective function accordingly The index always need to start in zero, but that category may correspond to anything in the objective. If you have a small example we can try to help.

The index that you use should matter as soon as you update the objective function accordingly The index always need to start in zero, but that category may correspond to anything in the objective. If you have a small example we can try to help.

This was closed, but was it fixed? Any tips on how to avoid this issue? I've seen it come up on some pet projects lately.

I encounter the same problem in version '1.2.6' so I think it hasn't got fixed yet

This was never addressed. At the moment categorial variables still have to be passed by index. Unfortunately the best answer I have right now is that if someone is bothered enough to create a PR to fix it, we'll happily merge it in.

At the very least let's reopen this. I think it was closed because it is behavior by design. Very poor design, admittedly.

Still same issue

@yenicelik GPyOpt has been EOL'd, I'd recommend the emukit project by some of the same authors.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benmoseley picture benmoseley  Â·  4Comments

CarrKnight picture CarrKnight  Â·  7Comments

ahyoussef picture ahyoussef  Â·  5Comments

cbelth picture cbelth  Â·  6Comments

vsariola picture vsariola  Â·  11Comments