plot_change_points_interactive

plot_change_points_interactive(ts, change_point_model: ruptures.base.BaseEstimator, model: ruptures.base.BaseCost, params_bounds: Dict[str, Tuple[Union[int, float], Union[int, float], Union[int, float]]], model_params: List[str], predict_params: List[str], in_column: str = 'target', segments: Optional[List[str]] = None, columns_num: int = 2, figsize: Tuple[int, int] = (10, 5), start: Optional[str] = None, end: Optional[str] = None)[source]

Plot a time series with indicated change points.

Change points are obtained using the specified method. The method parameters values can be changed using the corresponding sliders.

Parameters
  • ts – TSDataset with timeseries data

  • change_point_model (ruptures.base.BaseEstimator) – model to get trend change points

  • model (ruptures.base.BaseCost) – binseg segment model, [“l1”, “l2”, “rbf”,…]. Not used if ‘custom_cost’ is not None

  • params_bounds (Dict[str, Tuple[Union[int, float], Union[int, float], Union[int, float]]]) – Parameters ranges of the change points detection. Bounds for the parameter are (min,max,step)

  • model_params (List[str]) – List of iterable parameters for initialize the model

  • predict_params (List[str]) – List of iterable parameters for predict method

  • in_column (str) – column to plot

  • segments (Optional[List[str]]) – segments to use

  • columns_num (int) – number of subplots columns

  • figsize (Tuple[int, int]) – size of the figure in inches

  • start (Optional[str]) – start timestamp for plot

  • end (Optional[str]) – end timestamp for plot

Notes

Jupyter notebook might display the results incorrectly, in this case try to use !jupyter nbextension enable --py widgetsnbextension.

Examples

>>> from etna.datasets import TSDataset
>>> from etna.datasets import generate_ar_df
>>> from etna.analysis import plot_change_points_interactive
>>> from ruptures.detection import Binseg
>>> classic_df = generate_ar_df(periods=1000, start_time="2021-08-01", n_segments=2)
>>> df = TSDataset.to_dataset(classic_df)
>>> ts = TSDataset(df, "D")
>>> params_bounds = {"n_bkps": [0, 5, 1], "min_size":[1,10,3]}
>>> plot_change_points_interactive(ts=ts, change_point_model=Binseg, model="l2", params_bounds=params_bounds, model_params=["min_size"], predict_params=["n_bkps"], figsize=(20, 10))