_OneSegmentChangePointsTrendTransform¶
- class _OneSegmentChangePointsTrendTransform(in_column: str, change_point_model: ruptures.base.BaseEstimator, detrend_model: Type[sklearn.base.RegressorMixin], **change_point_model_predict_params)[source]¶
Bases:
etna.transforms.base.Transform
_OneSegmentChangePointsTransform subtracts multiple linear trend from series.
Init _OneSegmentChangePointsTrendTransform.
- Parameters
in_column (str) – name of column to apply transform to
change_point_model (ruptures.base.BaseEstimator) – model to get trend change points
detrend_model (Type[sklearn.base.RegressorMixin]) – model to get trend in data
change_point_model_predict_params – params for
change_point_model.predict
method
- Inherited-members
Methods
fit
(df)Fit OneSegmentChangePointsTransform: find trend change points in
df
, fit detrend models with data from intervals of stable trend.fit_transform
(df)May be reimplemented.
Split df to intervals of stable trend according to previous change point detection and add trend to each one.
transform
(df)Split df to intervals of stable trend and subtract trend from each one.
- fit(df: pandas.core.frame.DataFrame) etna.transforms.decomposition.change_points_trend._OneSegmentChangePointsTrendTransform [source]¶
Fit OneSegmentChangePointsTransform: find trend change points in
df
, fit detrend models with data from intervals of stable trend.- Parameters
df (pandas.core.frame.DataFrame) – one segment dataframe indexed with timestamp
- Return type
etna.transforms.decomposition.change_points_trend._OneSegmentChangePointsTrendTransform
- inverse_transform(df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame [source]¶
Split df to intervals of stable trend according to previous change point detection and add trend to each one.
- Parameters
df (pandas.core.frame.DataFrame) – one segment dataframe to turn trend back
- Returns
df – df with restored trend in in_column
- Return type
pd.DataFrame
- transform(df: pandas.core.frame.DataFrame) pandas.core.frame.DataFrame [source]¶
Split df to intervals of stable trend and subtract trend from each one.
- Parameters
df (pandas.core.frame.DataFrame) – one segment dataframe to subtract trend
- Returns
detrended df – df with detrended in_column series
- Return type
pd.DataFrame