skopt.space.transformers.LabelEncoder

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

LabelEncoder that can handle categorical variables.

Methods

fit(X)

Fit a list or array of categories.

inverse_transform(Xt)

Inverse transform integer categories back to their original

transform(X)

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

__init__(X=None)[source][source]

Initialize self. See help(type(self)) for accurate signature.

fit(X)[source][source]

Fit a list or array of categories.

Parameters
Xarray-like, shape=(n_categories,)

List of categories.

inverse_transform(Xt)[source][source]
Inverse transform integer categories back to their original

representation.

Parameters
Xtarray-like, shape=(n_samples, n_categories)

Integer categories.

Returns
Xarray-like, shape=(n_samples,)

The original categories.

transform(X)[source][source]

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

Parameters
Xarray-like, shape=(n_samples,)

List of categories.

Returns
Xtarray-like, shape=(n_samples, n_categories)

The integer categories.