orion.primitives.timeseries_anomalies.find_anomalies

orion.primitives.timeseries_anomalies.find_anomalies(errors, index, z_range=0, 10, window_size=None, window_size_portion=None, window_step_size=None, window_step_size_portion=None, min_percent=0.1, anomaly_padding=50, lower_threshold=False, fixed_threshold=None, inverse=False)[source]

Find sequences of error values that are anomalous.

We first define the window of errors, that we want to analyze. We then find the anomalous sequences in that window and store the start/stop index pairs that correspond to each sequence, along with its score. Optionally, we can flip the error sequence around the mean and apply the same procedure, allowing us to find unusually low error sequences. We then move the window and repeat the procedure. Lastly, we combine overlapping or consecutive sequences.

Parameters
  • errors (ndarray) – Array of errors.

  • index (ndarray) – Array of indices of the errors.

  • z_range (list) – Optional. List of two values denoting the range out of which the start points for the scipy.fmin function are chosen. If not given, (0, 10) is used.

  • window_size (int) – Optional. Size of the window for which a threshold is calculated. If not given, None is used, which finds one threshold for the entire sequence of errors.

  • window_size_portion (float) – Optional. Specify the size of the window to be a portion of the sequence of errors. If not given, None is used, and window size is used as is.

  • window_step_size (int) – Optional. Number of steps the window is moved before another threshold is calculated for the new window.

  • window_step_size_portion (float) – Optional. Specify the number of steps to be a portion of the window size. If not given, None is used, and window step size is used as is.

  • min_percent (float) – Optional. Percentage of separation the anomalies need to meet between themselves and the highest non-anomalous error in the window sequence. It nof given, 0.1 is used.

  • anomaly_padding (int) – Optional. Number of errors before and after a found anomaly that are added to the anomalous sequence. If not given, 50 is used.

  • lower_threshold (bool) – Optional. Indicates whether to apply a lower threshold to find unusually low errors. If not given, False is used.

  • fixed_threshold (bool) – Optional. Indicates whether to use fixed threshold or dynamic threshold. If not given, False is used.

  • inverse (bool) – Optional. Indicate whether to take the inverse of errors.

Returns

Array containing start-index, end-index, score for each anomalous sequence that was found.

Return type

ndarray