TrendTransform¶
- class TrendTransform(in_column: str, out_column: Optional[str] = None, detrend_model: Type[sklearn.base.RegressorMixin] = LinearRegression(), model: str = 'ar', custom_cost: Optional[ruptures.base.BaseCost] = None, min_size: int = 2, jump: int = 1, n_bkps: int = 5, pen: Optional[float] = None, epsilon: Optional[float] = None)[source]¶
Bases:
etna.transforms.decomposition.trend._TrendTransform
,etna.transforms.base.FutureMixin
TrendTransform adds trend as a feature.
TrendTransform uses uses
ruptures.detection.Binseg
model as a change point detection model in _TrendTransform.Warning
This transform can suffer from look-ahead bias. For transforming data at some timestamp it uses information from the whole train part.
Init TrendTransform.
- Parameters
in_column (str) – name of column to apply transform to
out_column (Optional[str]) – name of added column. If not given, use
self.__repr__()
detrend_model (Type[sklearn.base.RegressorMixin]) – model to get trend in data
model (str) – binseg segment model, [“l1”, “l2”, “rbf”,…]. Not used if ‘custom_cost’ is not None.
custom_cost (Optional[ruptures.base.BaseCost]) – binseg custom cost function
min_size (int) – minimum segment length necessary to decide it is a stable trend segment
jump (int) – jump value can speed up computations: if
jump==k
, the algo will use every k-th value for change points search.n_bkps (int) – number of change points to find
pen (Optional[float]) – penalty value (>0)
epsilon (Optional[float]) – reconstruction budget (>0)
- Inherited-members
Methods
fit
(df)Fit transform on each segment.
fit_transform
(df)May be reimplemented.
inverse_transform
(df)Apply inverse_transform to each segment.
transform
(df)Apply transform to each segment separately.