_OneSegmentSTLTransform

class _OneSegmentSTLTransform(in_column: str, period: int, model: Union[str, statsmodels.tsa.base.tsa_model.TimeSeriesModel] = 'arima', robust: bool = False, model_kwargs: Optional[Dict[str, Any]] = None, stl_kwargs: Optional[Dict[str, Any]] = None)[source]

Bases: etna.transforms.base.OneSegmentTransform

Init _OneSegmentSTLTransform.

Parameters
  • in_column (str) – name of processed column

  • period (int) – size of seasonality

  • model (Union[str, statsmodels.tsa.base.tsa_model.TimeSeriesModel]) –

    model to predict trend, default options are:

    1. ”arima”: ARIMA(data, 1, 1, 0) (default)

    2. ”holt”: ETSModel(data, trend='add')

    Custom model should be a subclass of statsmodels.tsa.base.tsa_model.TimeSeriesModel and have method get_prediction (not just predict)

  • robust (bool) – flag indicating whether to use robust version of STL

  • model_kwargs (Optional[Dict[str, Any]]) – parameters for the model like in statsmodels.tsa.seasonal.STLForecast

  • stl_kwargs (Optional[Dict[str, Any]]) – additional parameters for statsmodels.tsa.seasonal.STLForecast

Inherited-members

Methods

fit(df)

Perform STL decomposition and fit trend model.

fit_transform(df)

Fit and transform Dataframe.

inverse_transform(df)

Add trend and seasonal component.

set_params(**params)

Return new object instance with modified parameters.

to_dict()

Collect all information about etna object in dict.

transform(df)

Subtract trend and seasonal component.

fit(df: pandas.core.frame.DataFrame) etna.transforms.decomposition.stl._OneSegmentSTLTransform[source]

Perform STL decomposition and fit trend model.

Parameters

df (pandas.core.frame.DataFrame) – Features dataframe with time

Returns

result – instance after processing

Return type

_OneSegmentSTLTransform

inverse_transform(df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame[source]

Add trend and seasonal component.

Parameters

df (pandas.core.frame.DataFrame) – Features dataframe with time

Returns

result – Dataframe with extracted features

Return type

pd.DataFrame

transform(df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame[source]

Subtract trend and seasonal component.

Parameters

df (pandas.core.frame.DataFrame) – Features dataframe with time

Returns

result – Dataframe with extracted features

Return type

pd.DataFrame