deephyper.skopt.space.space.check_dimension

deephyper.skopt.space.space.check_dimension#

deephyper.skopt.space.space.check_dimension(dimension, transform=None)[source]#

Turn a provided dimension description into a dimension object.

Checks that the provided dimension falls into one of the supported types. For a list of supported types, look at the documentation of dimension below.

If dimension is already a Dimension instance, return it.

Parameters:
  • dimension (Dimension) –

    Search space Dimension. Each search dimension can be defined either as

    • a (lower_bound, upper_bound) tuple (for Real or Integer dimensions),

    • a (lower_bound, upper_bound, “prior”) tuple (for Real dimensions),

    • as a list of categories (for Categorical dimensions), or

    • an instance of a Dimension object (Real, Integer or Categorical).

  • transform (str) –

    One of “identity”, “normalize”, “string”, “label”, “onehot” optional

    • For Categorical dimensions, the following transformations are supported.

      • ”onehot” (default) one-hot transformation of the original space.

      • ”label” integer transformation of the original space

      • ”string” string transformation of the original space.

      • ”identity” same as the original space.

    • For Real and Integer dimensions, the following transformations are supported.

      • ”identity”, (default) the transformed space is the same as the original space.

      • ”normalize”, the transformed space is scaled to be between 0 and 1.

Returns:

Dimension instance.

Return type:

dimension (Dimension)