_OneSegmentLinearTrendBaseTransform¶
- class _OneSegmentLinearTrendBaseTransform(in_column: str, regressor: sklearn.base.RegressorMixin, poly_degree: int = 1)[source]¶
Bases:
etna.transforms.base.OneSegmentTransform
Transform for one segment that implements trend subtraction and reconstruction feature.
Create instance of _OneSegmentLinearTrendBaseTransform.
- Parameters
in_column (str) – name of processed column
regressor (sklearn.base.RegressorMixin) – instance of sklearn :py:class`sklearn.base.RegressorMixin` to predict trend
poly_degree (int) – degree of polynomial to fit trend on
- Inherited-members
Methods
fit
(df)Fit regression detrend_model with data from df.
fit_transform
(df)Fit regression detrend_model with data from df and subtract the trend from df.
Inverse transformation for trend subtraction: add trend to prediction.
set_params
(**params)Return new object instance with modified parameters.
to_dict
()Collect all information about etna object in dict.
transform
(df)Transform data from df: subtract linear trend found by regressor.
- fit(df: pandas.core.frame.DataFrame) etna.transforms.decomposition.detrend._OneSegmentLinearTrendBaseTransform [source]¶
Fit regression detrend_model with data from df.
- Parameters
df (pandas.core.frame.DataFrame) – data that regressor should be trained with
- Returns
instance with trained regressor
- Return type
- fit_transform(df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame [source]¶
Fit regression detrend_model with data from df and subtract the trend from df.
- Parameters
df (pandas.core.frame.DataFrame) – data to train regressor and transform
- Returns
residue after trend subtraction
- Return type
pd.DataFrame