deephyper.skopt.space.transformers.LabelEncoder

deephyper.skopt.space.transformers.LabelEncoder#

class deephyper.skopt.space.transformers.LabelEncoder(X=None)[source]#

Bases: Transformer

LabelEncoder that can handle categorical variables.

Methods

fit

Fit a list or array of categories.

inverse_transform

Inverse transform integer categories back to their original representation.

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 integer categories back to their original representation.

Parameters:

Xt (array-like, shape=(n_samples, n_categories)) – Integer categories.

Returns:

The original categories.

Return type:

X (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:

The integer categories.

Return type:

Xt (array-like, shape=(n_samples, n_categories))