Skip to content

Parameter Types: Handling and Implementation #376

@till-m

Description

@till-m

Why?
Support for non-float parameters types is by far the most-request feature that this package doesn't have as of now.

Why this issue?
I would like to explicitly discuss if and how to implement parameter types. In that sense this issue isn't a feature request, but intended to server as a space to collect discussions about this topic.

How?
For my perspective, Garrido-Merchán and Hernández-Lobato seems to make the most sense.
This means converting the parameters within the kernel: $$\tilde{k}( x_i, x_j)=k(T(x_i), T(x_j))$$ where $T$ acts on elements of $x_i$ according to their type.

What is necessary?
Essentially all of this "only" requires three functions to transform the parameters:

  • A function that converts the "canonical" representation of the parameters to the representation used by the kernel.
    • float and int parameters remain unchangend, one-hot-encoding is applied to categorical variables
  • A function that converts the kernel representation to the canonical representation, used whenever the user interacts with parameters (logs, optimizer.max(), etc)
    • float and int parameters remain unchangend, reverse the one-hot-encoding.
  • A function that converts the all-float parameter suggestions produced by _space.random_sample() and acq_max() into kernel representation.

Naturally, it requires changing a lot of other code, too; and particularly in ways that make everything a bit messier. Additionally, wrapping the kernel requires some slightly hacky python magic due to the way sklearn.gaussian_process' kernels are set up.

Alternatives
Instead of offering proper support, we could simply refer users to @leifvan's implementation here. Alternatively, we could set up a notebook that demonstrates his approach. I'm almost favouring this approach since I'm worried about cluttering the API too much.

Are you able and willing to implement this feature yourself and open a pull request?

  • Yes, I can provide this feature -- it's pretty much ready/functional too, I will push it soon and link it here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions