paddlets.transform.onehot
- class OneHot(cols: ~typing.Union[str, ~typing.List], dtype: object = <class 'numpy.float64'>, handle_unknown: str = 'error', categories: ~typing.Union[str, ~typing.List] = 'auto', drop: bool = False)[source]
Bases:
BaseTransformTransform categorical columns with OneHot encoder.
- Parameters
cols (str|List) – Column(s) to be encoded.
handle_unknown (str) – {‘error’, ‘ignore’}, default=’error’
drop (bool) – Whether to delete the original column, default=False
dtype (object) – Data type, default=float
categorie (str|List) – ‘auto’ or a list of array-like, default=’auto’, if categorie is ‘auto’, it determine categories automatically from the dataset.
- Returns
None
- fit(dataset: TSDataset)[source]
Fit the ecnoder with the dataset.
- Parameters
dataset (TSDataset) – dataset from which to fit the encoder
- Returns
self