Your question is Real-Time Anomaly Detection Algorithm. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
Airbus Skywise receives telemetry values continuously from aircraft systems. Implement a bounded-memory detector that flags values which are unusually far from the recent signal level while adapting to gradual changes in the baseline.
Use an exponentially weighted mean and variance. For each incoming value, evaluate whether it is anomalous against the statistics accumulated from earlier values, then update the statistics with the new value. A value is anomalous when its absolute deviation from the current mean is greater than threshold standard deviations. Do not let the current value influence the decision made for that value.
Implement detect_anomalies(values, alpha, threshold, warmup), where values is a list of numeric telemetry readings, alpha is the update factor in (0, 1], threshold is a positive float, and warmup is the number of prior readings required before detection begins. Return a Boolean list of the same length as values.
The detector must use memory independent of len(values), apart from the returned result. Treat readings during warmup as non-anomalous. If the prior variance is zero, flag a different value after warmup as anomalous.
def detect_anomalies(values, alpha, threshold, warmup):