deephyper.skopt.space.StringEncoder#

class deephyper.skopt.space.StringEncoder(dtype=<class 'str'>)[source]#

Bases: Transformer

StringEncoder transform. The transform will cast everything to a string and the inverse transform will cast to the type defined in dtype.

Methods

fit

Fit a list or array of categories.

inverse_transform

Inverse transform string encoded categories back to their original

transform

Transform an array of categories to a string encoded representation.

fit(X)[source]#

Fit a list or array of categories. All elements must be from the same type.

Parameters:

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

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

representation.

Parameters:

Xt (array-like, shape=(n_samples,)) – String encoded categories.

Returns:

X – The original categories.

Return type:

array-like, shape=(n_samples,)

transform(X)[source]#

Transform an array of categories to a string encoded representation.

Parameters:

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

Returns:

Xt – The string encoded categories.

Return type:

array-like, shape=(n_samples,)