deephyper.skopt.space.space.Categorical#
- class deephyper.skopt.space.space.Categorical(categories, prior=None, transform=None, name=None)[source]#
Bases:
Dimension
Search space dimension that can take on categorical values.
- Parameters:
categories (list, shape=(n_categories,)) – Sequence of possible categories.
prior (list, shape=(categories,), default=None) – Prior probabilities for each category. By default all categories are equally likely.
transform ("onehot", "string", "identity", "label", default="onehot") –
“identity”, the transformed space is the same as the original space.
”string”, the transformed space is a string encoded representation of the original space.
”label”, the transformed space is a label encoded representation (integer) of the original space.
”onehot”, the transformed space is a one-hot encoded representation of the original space.
name (str or None) – Name associated with dimension, e.g., “colors”.
Methods
Compute distance between category a and b.
Inverse transform samples from the warped space back into the original space.
Draw random samples.
Define _rvs and transformer spaces.
Transform samples form the original space to a warped space.
Attributes
bounds
is_constant
name
prior
size
transformed_bounds
transformed_size
- distance(a, b)[source]#
Compute distance between category a and b.
As categories have no order the distance between two points is one if a != b and zero otherwise.
- Parameters:
a (category) – First category.
b (category) – Second category.
- inverse_transform(Xt)[source]#
Inverse transform samples from the warped space back into the original space.
- set_transformer(transform='onehot')[source]#
Define _rvs and transformer spaces.
- Parameters:
transform (str) – Can be ‘normalize’, ‘onehot’, ‘string’, ‘label’, or ‘identity’
- transform(X)#
Transform samples form the original space to a warped space.