deephyper.skopt.space.transformers.CategoricalEncoder#

class deephyper.skopt.space.transformers.CategoricalEncoder[source]#

Bases: Transformer

OneHotEncoder that can handle categorical variables.

Methods

fit

Fit a list or array of categories.

inverse_transform

Inverse transform one-hot encoded categories back to their original

transform

Transform an array of categories to a one-hot encoded representation.

fit(X)[source]#

Fit a list or array of categories.

Parameters:

X (array-like, shape=(n_categories,)) – List of categories.

inverse_transform(Xt)[source]#
Inverse transform one-hot encoded categories back to their original

representation.

Parameters:

Xt (array-like, shape=(n_samples, n_categories)) – One-hot encoded categories.

Returns:

X – The original categories.

Return type:

array-like, shape=(n_samples,)

transform(X)[source]#

Transform an array of categories to a one-hot encoded representation.

Parameters:

X (array-like, shape=(n_samples,)) – List of categories.

Returns:

Xt – The one-hot encoded categories.

Return type:

array-like, shape=(n_samples, n_categories)