mean_anomaly_score#

mean_anomaly_score(precomputed_params: ndarray, interval_starts: ndarray, interval_ends: ndarray, anomaly_starts: ndarray, anomaly_ends: ndarray) ndarray[source]#

Calculate the CUSUM score for difference in the mean of a subinterval.

Compares the mean of the data in anomaly_start:anomaly_end (both inclusive) to the mean of the complement of interval_start:interval_end (both inclusive) and anomaly_start:anomaly_end.

The overall and anomalous intervals must satisfy interval_start > anomaly_start <= anomaly_end <= interval_end.

Parameters:
precomputed_paramsnp.ndarray

Precomputed parameters from init_mean_score.

interval_startsnp.ndarray

Start indices of the intervals to test for an anomaly in.

interval_endsnp.ndarray

End indices of the intervals to test for an anomaly in.

anomaly_startsnp.ndarray

Start indices of the anomalies.

anomaly_endsnp.ndarray

End indices of the anomalies.

Returns:
np.ndarray

Score for a difference in the mean.

Notes

To optimize performance, no checks are performed on the inputs.