OneHotEncoderTransform

class OneHotEncoderTransform(in_column: str, out_column: Optional[str] = None)[source]

Bases: etna.transforms.base.IrreversibleTransform

Encode categorical feature as a one-hot numeric features.

If unknown category is encountered during transform, the resulting one-hot encoded columns for this feature will be all zeros.

Init OneHotEncoderTransform.

Parameters
  • in_column (str) – Name of column to be encoded

  • out_column (Optional[str]) – Prefix of names of added columns. If not given, use self.__repr__()

Inherited-members

Methods

fit(ts)

Fit the transform.

fit_transform(ts)

Fit and transform TSDataset.

get_regressors_info()

Return the list with regressors created by the transform.

inverse_transform(ts)

Inverse transform TSDataset.

load(path)

Load an object.

params_to_tune()

Get grid for tuning hyperparameters.

save(path)

Save the object.

set_params(**params)

Return new object instance with modified parameters.

to_dict()

Collect all information about etna object in dict.

transform(ts)

Transform TSDataset inplace.

fit(ts: etna.datasets.tsdataset.TSDataset) etna.transforms.encoders.categorical.OneHotEncoderTransform[source]

Fit the transform.

Parameters

ts (etna.datasets.tsdataset.TSDataset) –

Return type

etna.transforms.encoders.categorical.OneHotEncoderTransform

get_regressors_info() List[str][source]

Return the list with regressors created by the transform.

Return type

List[str]