# Anomaly Detection in Financial Time Series by Principal Component Analysis and Neural Networks +
## 9 Conclusions  
We propose a two-step approach for detecting anomalies in a panel of time series that can reflect a wide variety of market risk factors. The first step aims to identify the contaminated time series, i.e., time series with anomalies. The second step focuses on the localization of the anomalies among the observed values of the identified contaminated time series. As a pre-processing step, our methodology integrates the extraction of features from the time series with PCA. This part of the method proved to be essential, as it provides the models with inputs on which the distinction between abnormal/contaminated and normal instances is based while also ensuring the stationarity of the model's (time series) inputs. Another key point of the approach is the calibration of the cutoff value, which is the key parameter in the identification of contaminated time series by means of a feedforward neural network with a customized loss function. The proposed approach suggests an imputation value; however, this value is strongly influenced by the abnormal value. Therefore, basic imputation approaches with similar complexities are preferred. Our numerical experiments not only show that our approach outperforms the baseline anomaly detection models but also the real benefits that could be gained from applying it as a preliminary data cleaning step prior to VaR computations. Future research could focus on the replacement of PCA by partial least squares (PLS) or deep PLS [15] for endogenizing the feature extraction stage. Regarding downstream tasks, our approach might be of special interest for reverse stress tests [16]. Conceptualization, S.C., N.L., N.M. and M.T. ; methodology, S.C., N.L., N.M. and M.T. ; software N.M.; validation, S.C., N.L., N.M. and M.T. ; formal analysis, S.C., N.L., N.M. and M.T. ; investigation, S.C., N.L., N.M. and M.T. ; resources, S.C., N.L., N.M. and M.T. ; data curation N.L. and N.M.; writing--original draft preparation, N.M.; writing--review and editing, S.C., N.L., N.M. and M.T. ; visualization, S.C., N.L., N.M. and M.T. ; supervision, S.C., N.L. and M.T. ; project administration, S.C., N.L. and M.T. ; funding acquisition, S.C., N.L. All authors have read and agreed to the published version of the manuscript. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Accuracy** & **Precision** & **Recall** & \(\mathbf{F_{1}}\)**-Score** \\ \hline IF & 78.50\% & 2.173\% & 98.35\% & 4.252\% \\ LOF & 87.04\% & 0.3713\% & 9.616\% & 0.7151\% \\ DBSCAN & N/A & N/A & N/A & N/A \\ sig-IF & N/A & N/A & N/A & N/A \\ \hline KNN & 99.85\% & 78.38\% & 95.59\% & 86.13\% \\ SVM & N/A & N/A & N/A & N/A \\ PCA NN & 96.05\% & 96.21\% & 96.05\% & 95.92\% \\ \hline \hline \end{tabular}
\end{table} 
Table 24: Performance evaluation of unsupervised (**upper part**) and supervised (**lower part**) models in the contaminated time series localization step. Results for DBSCAN, sig-IF, and SVM are not provided due to high computational costs. \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Model** & **Accuracy** & **Precision** & **Recall** & \(\mathbf{F_{1}}\)**-Score** \\ \hline IF & 73.17\% & 18.12\% & 17.53\% & 17.82\% \\ LOF & 82.33\% & 44.57\% & 26.62\% & 33.33\% \\ DBSCAN & 22.74\% & 15.71\% & 83.77\% & 26.46\% \\ sig-IF & 73.34\% & 18.15\% & 17.47\% & 17.80\% \\ \hline KNN & 70.26\% & 23.48\% & 35.06\% & 28.13\% \\ SVM & 50.11\% & 24.46\% & 96.10\% & 39.00\% \\ PCA NN & 88.15\% & 72.45\% & 46.10\% & 56.35\% \\ \hline \hline \end{tabular}
\end{table} 
Table 23: Performance evaluation of unsupervised (**upper part**) and supervised (**lower part**) models in the contaminated time series identification step. **Funding:** The research of [PERSON] is funded by a CIFRE grant from Natixis.