gluonts.nursery.anomaly_detection.filters module#
- gluonts.nursery.anomaly_detection.filters.fill_forward(a: numpy.ndarray, fill_start=None) numpy.ndarray [source]#
Forward fill an array.
If fill_start is not None, then the NaNs in the beginning of the array will be filled with fill_start.
- gluonts.nursery.anomaly_detection.filters.labels_filter(a: numpy.ndarray, num_open: int, num_clear: int, initial_label: int = 0, forward_fill: bool = False)[source]#
- gluonts.nursery.anomaly_detection.filters.n_k_filter(a: numpy.ndarray, num_open: int, num_clear: int, num_open_suff: Optional[int] = None, num_clear_suff: Optional[int] = None, initial_label: int = 0, forward_fill: bool = False) numpy.ndarray [source]#
Implements the (N, K)-filter that opens/closes anomalies based on observing K or greater labels in the last N time steps.
- Parameters
a – input array, type boolean
num_open – number of time steps to look back for opening an anomaly
num_clear – number of time steps to look back for clearing an anomaly
num_open_suff – number of positive labels in the lookback period sufficient to open an anomaly. defaults to num_open.
num_clear_suff – number of positive labels in the lookback period sufficient to clear an anomaly. defaults to num_clear.
initial_label – 1 if the initial state is an anomaly, 0 if not. default 0.