etna.analysis.get_anomalies_mad#

get_anomalies_mad(ts: TSDataset, in_column: str = 'target', window_size: int = 10, stride: int = 1, mad_scale: float = 3, trend: bool = False, seasonality: bool = False, period: int | None = None, stl_params: Dict[str, Any] | None = None, index_only: bool = True) Dict[str, List[Timestamp] | List[int] | Series][source]#

Get point outliers in time series using median absolute deviation. Detects outliers in a row that fall out of range: [median - mad_scale * mad; median + mad_scale * mad]

Parameters:
  • ts (TSDataset) – TSDataset with timeseries data

  • in_column (str) – name of the column in which the anomaly is searching

  • window_size (int) – number of points in the window

  • stride (int) – offset between neighboring windows.

  • mad_scale (float) – scaling parameter of the estimated interval.

  • trend (bool) – whether to remove trend from the series.

  • seasonality (bool) – whether to remove seasonality from the series

  • period (int | None) – periodicity of the sequence for STL.

  • stl_params (Dict[str, Any] | None) – other parameters for STL. See statsmodels.tsa.seasonal.STL

  • index_only (bool) – whether to return only outliers indices. If False will return outliers series

Returns:

dict of outliers in format {segment: [outliers_timestamps]}

Return type:

Dict[str, List[Timestamp] | List[int] | Series]