Dynamic Error Thresholds

前言

Detecting Spacecraft Anomalies Using LSTMs and Nonparametric Dynamic Thresholding

Errors and Smoothing

$\mathbf{e} = [e^{(t-h)}, \dots, e^{(t-l_s)}, \dots, e^{(t-1)}, e^t]$

$\mathbf{e}_s = [e_s^{(t-h)}, \dots, e_s^{(t-l_s)}, \dots, e_s^{(t-1)}, e_s^t]$

Threshold Calculation and Anomaly Scoring

$\mathbf{\epsilon} = \mu(\mathbf{e}_s) + \mathbf{z}\sigma(\mathbf{e}_s)$

$\epsilon = argmax(\mathbf{\epsilon}) = \frac{\Delta \mu(\mathbf{e}_s) / \mu(\mathbf{e}_s) + \Delta \sigma(\mathbf{e}_s) / \sigma(\mathbf{e}_s)}{\vert \mathbf{e}_a \vert + \vert \mathbf{E}_{seq} \vert^2}$

$\Delta \mu(\mathbf{e}_s) = \mu(\mathbf{e}_s) - \mu(\{e_s \in \mathbf{e}_s \vert e_s < \epsilon\}) \\ \Delta \sigma(\mathbf{e}_s) = \sigma(\mathbf{e}_s) - \sigma(\{e_s \in \mathbf{e}_s \vert e_s < \epsilon \}) \\ \mathbf{e}_a = \{e_s \in \mathbf{e}_s \vert e_s > \epsilon\} \\ \mathbf{E}_{seq} = \text{continuous sequences of } e_a \in \mathbf{e}_a$

Pruning Anomalies

$e_{max}$中的连续两个序列计算：

$d^{(i)} = \frac{e_{max}^{(i-1)} - e_{max}^{(i)}}{e_{max}^{(i-1)}} \quad ,i \in \{1,2,\dots,(\vert \mathbf{E}_{seq} \vert + 1)\}$

代码实现

Data and calculations for a specific window of prediction errors. Includes finding thresholds, pruning, and scoring anomalous sequences for errors and inverted errors (flipped around mean) - significant drops in values can also be anomalous.