Transform

class Transform(required_features: Union[Literal['all'], List[str]])[source]

Bases: etna.core.mixins.SaveMixin, etna.core.mixins.BaseMixin

Base class to create any transforms to apply to data.

Inherited-members

Parameters

required_features (Union[Literal['all'], typing.List[str]]) –

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.base.Transform[source]

Fit the transform.

Parameters

ts (etna.datasets.tsdataset.TSDataset) – Dataset to fit the transform on.

Returns

The fitted transform instance.

Return type

etna.transforms.base.Transform

fit_transform(ts: etna.datasets.tsdataset.TSDataset) etna.datasets.tsdataset.TSDataset[source]

Fit and transform TSDataset.

May be reimplemented. But it is not recommended.

Parameters

ts (etna.datasets.tsdataset.TSDataset) – TSDataset to transform.

Returns

Transformed TSDataset.

Return type

etna.datasets.tsdataset.TSDataset

abstract get_regressors_info() List[str][source]

Return the list with regressors created by the transform.

Returns

List with regressors created by the transform.

Return type

List[str]

abstract inverse_transform(ts: etna.datasets.tsdataset.TSDataset) etna.datasets.tsdataset.TSDataset[source]

Inverse transform TSDataset.

Should be reimplemented in the subclasses where necessary.

Parameters

ts (etna.datasets.tsdataset.TSDataset) – TSDataset to be inverse transformed.

Returns

TSDataset after applying inverse transformation.

Return type

etna.datasets.tsdataset.TSDataset

params_to_tune() Dict[str, etna.distributions.distributions.BaseDistribution][source]

Get grid for tuning hyperparameters.

This is default implementation with empty grid.

Returns

Empty grid.

Return type

Dict[str, etna.distributions.distributions.BaseDistribution]

transform(ts: etna.datasets.tsdataset.TSDataset) etna.datasets.tsdataset.TSDataset[source]

Transform TSDataset inplace.

Parameters

ts (etna.datasets.tsdataset.TSDataset) – Dataset to transform.

Returns

Transformed TSDataset.

Return type

etna.datasets.tsdataset.TSDataset