skopt.space.space.check_dimension#
- 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
dimensionbelow.If
dimensionis already aDimensioninstance, return it.- Parameters:
- dimensionDimension
Search space Dimension. Each search dimension can be defined either as:
an instance of a
Dimensionobject (Real,IntegerorCategorical).a 2-, 3- or 4-tuple, for
RealandIntegerdimensions, of the form(low, high [, prior [, base]])(values in square brackets are optional). If bothlowandhighare integral numbers (as per thenumber.Integral), aIntegerdimension is returned, else aRealdimension is returned.any iterable for
CategoricaldimensionNote
For a transitionary period, the old behavior is retained. This means tuple, list and array currently all undergo dimension inference as describe in the tuple entry above. If no
IntegerorRealdimension can be inferred, aCategoricalis returned. This behavior will be tightened to the above description in an upcoming version, and a warning is raised if the upcoming inference would differ from the current behavior.
- transform“identity”, “normalize”, “string”, “label”, “onehot” optional
For
Categoricaldimensions, 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
RealandIntegerdimensions, 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:
- dimensionDimension
Dimension instance.