# Uncertainty-Aware Time Series Anomaly Detection
## 3 Proposed Approach
### Thresholding Mechanism
On the contrary, a model trained on high variance in data is more likely to recognize and categorize noise properly. ### Uncertainty Quantification Evaluation

To investigate uncertainty behavior during anomalies, we generate different synthetic datasets based on the sine function using the Time Series Generator (GutenTAG) [35], which is an extensible tool to generate time series data with and without anomalies. #### 4.2.1 Data

We create five different pairs of time series, one for each anomaly type we aim (Figure 6). The datasets contain data points according to the mathematical function \(sin(x)\). Each includes 100 points per period with an overall of 10 periods. The training set consists of clean data with little background noise. To each test dataset, we inject one anomaly which refers to a larger/smaller amplitude, an extremum, and a pattern anomaly as further specified in Table 5.

#### 4.2.2 Results

Starting with the anomaly of a larger amplitude than normal, observations presented in Figure 7 show a general trend where larger amplitudes correspond to heightened uncertainties. The established patterns mostly continue, with increased intensity and/or elevated baseline levels during anomalies. Notably, the ability of the model to recognize anomalies as uncertainty appears to be dependent on the input size. Some window sizes show stronger reactions, especially smaller windows, while others seem to be unaffected by the introduced anomalies. For instance, when considering an input size of 100 and its associated aleatoric uncertainty, the impact of anomalies seems completely absent. \begin{table}
\begin{tabular}{c c l} \hline \hline
**Anomaly** & **Length** & **Description** \\ \hline Amplitude larger & 200 & Larger amplitude with factor 2. \\ \hline Amplitude smaller & 200 & Smaller amplitude with factor 0.5. \\ \hline Global extremum & 1 & Extremum outside the scope of normal values. \\ \hline Pattern & 50 & Deviation from pattern with larger radius at one turning point of the sine curve. \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Specifications of anomalies in the test dataset. Figure 6: Anomalies in test data. Figure 7: Results for experiments with anomalies of larger amplitude. The highlighted area in red is the range where the anomaly takes place (see Figure 6). Having investigated the reaction of a larger amplitude, we now consider the opposite situation with a smaller amplitude. Results are illustrated in Figure 8. In contrast to the impact of larger amplitudes, a smaller amplitude is associated with reduced uncertainties. However, the general pattern in the data continues with less intense amplitudes. Also, certain input window sizes do not seem to influence the impact of smaller amplitude anomalies. Notably, input sizes such as 100 for aleatoric uncertainty, seem to miss the ability to capture the influence of reduced amplitudes. From amplitudes, we continue with the extremum anomaly with results in Figure 9. The anomaly is visible in the smallest input window size for both aleatoric and epistemic uncertainties. A distinct peak emerges in the uncertainty profiles, providing an indication of the anomaly's influence. In the second smallest input window size, deviations in the uncertainty patterns become more subtle. These deviations show up as a short noisy range or a dent in the uncertainty profiles. The distinct peaks observed in the smallest window size no longer appear. Interestingly, the extremum anomaly appears to have a minimal impact on uncertainties associated with larger input window sizes. For the majority of cases, uncertainties remain unimpacted. The results of introducing a pattern anomaly marked by a more rounded turning point in the sine curve, are introduced in Figure 10. The pattern anomaly shows a more intensive impact on uncertainties associated with smaller input window sizes (i.e., 10, 25). The deviations in uncertainty profiles are more prominent in configurations with reduced temporal context, indicating heightened sensitivity to anomalies in these scenarios.