skopt.space.transformers.CategoricalEncoder

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

OneHotEncoder that can handle categorical variables.

Methods

fit(self, X)

Fit a list or array of categories.

inverse_transform(self, Xt)

Inverse transform one-hot encoded categories back to their original

transform(self, X)

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

__init__(self)[source][source]

Convert labeled categories into one-hot encoded features.

fit(self, X)[source][source]

Fit a list or array of categories.

Parameters
Xarray-like, shape=(n_categories,)

List of categories.

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

representation.

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

One-hot encoded categories.

Returns
Xarray-like, shape=(n_samples,)

The original categories.

transform(self, 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 one-hot encoded categories.