LinearTrendTransform

class LinearTrendTransform(in_column: str, poly_degree: int = 1, **regression_params)[source]

Bases: etna.transforms.base.ReversiblePerSegmentWrapper

Transform that uses linear regression with polynomial features to make a detrending.

Transform fits a sklearn.linear_model.LinearRegression with polynomial features on each segment. Values predicted by the model are subtracted from each segment.

Warning

This transform can suffer from look-ahead bias. For transforming data at some timestamp it uses information from the whole train part.

Create instance of LinearTrendTransform.

Parameters
  • in_column (str) – name of processed column

  • poly_degree (int) – degree of polynomial to fit trend on

  • regression_params – params that should be used to init sklearn.linear_model.LinearRegression

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 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.

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 only poly_degree parameter. Other parameters are expected to be set by the user.

Returns

Grid to tune.

Return type

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