LabelEncoderTransform¶
- class LabelEncoderTransform(in_column: str, out_column: Optional[str] = None, strategy: str = ImputerMode.mean)[source]¶
Bases:
etna.transforms.base.IrreversibleTransform
Encode categorical feature with value between 0 and n_classes-1.
Init LabelEncoderTransform.
- Parameters
in_column (str) – Name of column to be transformed
out_column (Optional[str]) – Name of added column. If not given, use
self.__repr__()
strategy (str) –
Filling encoding in not fitted values:
If “new_value”, then replace missing values with ‘-1’
If “mean”, then replace missing values using the mean in encoded column
If “none”, then replace missing values with None
- Inherited-members
Methods
fit
(ts)Fit the transform.
fit_transform
(ts)Fit and transform TSDataset.
Return the list with regressors created by the transform.
inverse_transform
(ts)Inverse transform TSDataset.
load
(path)Load an object.
Get default 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.LabelEncoderTransform [source]¶
Fit the transform.
- Parameters
- Return type
- get_regressors_info() List[str] [source]¶
Return the list with regressors created by the transform.
- Return type
List[str]
- params_to_tune() Dict[str, etna.distributions.distributions.BaseDistribution] [source]¶
Get default grid for tuning hyperparameters.
This grid tunes
strategy
parameter. Other parameters are expected to be set by the user.- Returns
Grid to tune.
- Return type
Dict[str, etna.distributions.distributions.BaseDistribution]