daxs.filters: Filters for anomaly detection#

The module provides functions for filtering data.

daxs.filters.hampel(data: npt.NDArray[np.float64], window_size: int | None = None, threshold: float = 3.5, axis: int = 0, k: float = 1.4826)[source]#

Outliers detection using the Hampel filter.

More details about the filter can be found here:

Parameters:
  • data – Input data.

  • window_size – Size of the sliding window.

  • threshold – Threshold for outlier detection expressed in number of standard deviations. Iglewicz and Hoaglin [1] suggest using a value of 3.5, but larger values are often needed to avoid removing data points from a noisy signal.

  • axis – Axis along which the detection is performed.

  • k – Scale factor for the median absolute deviation. The default value is 1.4826, which is the scale factor for normally distributed data.

Returns:

Mask identifying the outliers, and the rolling window median.

Return type:

np.NDArray[np.bool_]

References