Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Compute distance with one point normalized #589

@chschroeder

Description

@chschroeder

Setting:

  • I have a space with only categorical variables (most of them containing integers admittedly)
  • ask and tell API is used with an gp optimizer

The first n_initial_points-many points are evaluated as expected. After that i get the following error:

 [ ... ] 
  File "/usr/local/lib/python3.6/site-packages/skopt/optimizer/optimizer.py", line 333, in ask
    x = opt.ask()
  File "/usr/local/lib/python3.6/site-packages/skopt/optimizer/optimizer.py", line 305, in ask
    return self._ask()
  File "/usr/local/lib/python3.6/site-packages/skopt/optimizer/optimizer.py", line 366, in _ask
    for xi in self.Xi])
  File "/usr/local/lib/python3.6/site-packages/skopt/optimizer/optimizer.py", line 366, in <listcomp>
    for xi in self.Xi])
  File "/usr/local/lib/python3.6/site-packages/skopt/space/space.py", line 721, in distance
    distance += dim.distance(a, b)
  File "/usr/local/lib/python3.6/site-packages/skopt/space/space.py", line 492, in distance
    " the space, not {} and {}.".format(a, b))
RuntimeError: Can only compute distance for values within the space, not 1.0 and 1750.

1.0 is not a reasonable value for this parameter (and far outside the bounds of the parameter space of that variable). Seems like one dimension is normalized and the other is not.

I am aware that using categoricals is probably not the most elegant way here. But this should work, shouldn't it?

When i have mixed variable types the categoricals seem to work fine. With Integers i often have the problem that the points to be evaluted quickly focus in the extreme values of the range. Is there maybe another way to solve this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions