plot_change_points_interactive#
- plot_change_points_interactive(ts, change_point_model: BaseEstimator, model: BaseCost, params_bounds: Dict[str, Tuple[int | float, int | float, int | float]], model_params: List[str], predict_params: List[str], in_column: str = 'target', segments: List[str] | None = None, columns_num: int = 2, figsize: Tuple[int, int] = (10, 5), start: str | None = None, end: str | None = 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 (BaseEstimator) – model to get trend change points
model (BaseCost) – binseg segment model, [“l1”, “l2”, “rbf”,…]. Not used if ‘custom_cost’ is not None
params_bounds (Dict[str, Tuple[int | float, int | float, 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
columns_num (int) – number of subplots columns
start (str | None) – start timestamp for plot
end (str | None) – 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))