etna.analysis.plot_anomalies_interactive#
- plot_anomalies_interactive(ts: TSDataset, segment: str, method: Callable[[...], Dict[str, List[Timestamp | int]]], params_bounds: Dict[str, Tuple[int | float, int | float, int | float]], in_column: str = 'target', figsize: Tuple[int, int] = (20, 10), start: Timestamp | int | str | None = None, end: Timestamp | int | 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 | int]]]) – 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 (Timestamp | int | str | None) – start timestamp for plot 
 
 - Notes - Jupyter notebook might display the results incorrectly, in this case try to use - !jupyter nbextension enable --py widgetsnbextension.- Raises:
- ValueError: – Incorrect type of - startor- endis used according to- ts.freq.
- Parameters:
 - Examples - >>> from etna.datasets import TSDataset >>> from etna.datasets import generate_ar_df >>> from etna.analysis import plot_anomalies_interactive, get_anomalies_density >>> df = generate_ar_df(periods=1000, start_time="2021-08-01", n_segments=2) >>> 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))