BinsegTrendTransform

class BinsegTrendTransform(in_column: str, detrend_model: Optional[Type[sklearn.base.RegressorMixin]] = None, 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.change_points_trend.ChangePointsTrendTransform

BinsegTrendTransform uses ruptures.detection.Binseg model as a change point detection model.

Warning

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

Init BinsegTrendTransform.

Parameters
  • in_column (str) – name of column to apply transform to

  • detrend_model (Optional[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.