residual over its sub-series, and compare it to the threshold $\tau$. If it exceeds the threshold, the time series is detected as anomalous. Monitoring the maximum of the residuals enables the detection of local anomalies that would impact one or few of the sub sequences.

Time Series To Image Encoding {#sec:encod}
=============================

Gramian Angular Field (GAF)
---------------------------

The Gramian Angular Field [@wang2015encoding] consists of a two-step process to transform a time series into a matrix. First, the transformation from the space (*Time*$\times$*Value*) to polar coordinates is performed. Then, the Gramian matrix in that new space is computed.

The transformation to polar coordinates consists of performing the following operation: $$\label{eq:GAF-pol}
     \begin{cases}
              \phi = \arccos(X_{norm,i}) ; \phi \in [0,\pi],
              \\
              r = \frac{n}{L}; r \in \mathbb{R}^+,
     \end{cases}$$ where L is scaling the temporal dimension but does not influence the final matrix. This transformation is bijective and absolute temporal relations are preserved[@wang2015encoding]. Since Equation \[eq:GAF-pol\] is only defined for $X\in [-1,1]$, it requires first the scaling of the data. [@wang2015encoding] propose to scale the input $X$ as $$X = (x_1,x_2,...,x_N),\quad
    X_{norm,i} = \frac{x_i - \mathrm{UB} + (x_i - \mathrm{LB})}{\mathrm{UB} - \mathrm{LB}} ; \in [-1,1],$$

where, UB and LB refer to the upper and 