etna.analysis.plot_anomalies_interactive#
- plot_anomalies_interactive(ts: TSDataset, segment: str, method: Callable[[...], Dict[str, List[Timestamp]]], params_bounds: Dict[str, Tuple[int | float, int | float, int | float]], in_column: str = 'target', figsize: Tuple[int, int] = (20, 10), start: str | None = None, end: str | None = None)[source]#
- Plot a time series with indicated anomalies. - Anomalies are obtained using the specified method. The method parameters values can be changed using the corresponding sliders. - Parameters:
- ts (TSDataset) – TSDataset with timeseries data 
- segment (str) – Segment to plot 
- method (Callable[[...], Dict[str, List[Timestamp]]]) – Method for outliers detection, e.g. - get_anomalies_density()
- params_bounds (Dict[str, Tuple[int | float, int | float, int | float]]) – Parameters ranges of the outliers detection method. Bounds for the parameter are (min,max,step) 
- in_column (str) – column to plot 
- 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_anomalies_interactive, get_anomalies_density >>> 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 = {"window_size": (5, 20, 1), "distance_coef": (0.1, 3, 0.25)} >>> method = get_anomalies_density >>> plot_anomalies_interactive(ts=ts, segment="segment_1", method=method, params_bounds=params_bounds, figsize=(20, 10))