## 6 Comparison between Isolation Forest and Variational Autoencoder Algorithms
### Comparison between the Algorithms  
Comparing the VAE results with the ones of IE, it was concluded that the latter would be a better solution for the problem studied, because, according to the obtained results, it presented more stable outcomes in terms of the final score. For example, the average value of \(S_{final}\) for the IF algorithm was 0.89, while it was 0.83 for the VAE. It was found, however, that the solution based on the VAE algorithm, when all the proposed anomalies  
\begin{table}
\begin{tabular}{r c c c c c c c c} \hline \hline
**Meters** & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} \\ \hline Water & 1 & 24 & 0.79 & 0.99 & 0.00 & 0.99 & 0.90 & 0.57 \\ Electricity 1 & 1 & 24 & 0.85 & 0.99 & 0.99 & 0.99 & 0.99 & 0.85 \\ Electricity 2 & 2 & 48 & 0.96 & 0.99 & 0.99 & 0.99 & 0.99 & 0.96 \\ Gas & 2 & 72 & 0.99 & 0.99 & 0.99 & 0.85 & 0.99 & 0.95 \\ \hline \hline \end{tabular}
\end{table}
Table 6: Best results for each meter with the VAE algorithm, according to the proposed metric, among all scenarios and considering the mentioned grid-search.  
\begin{table}
\begin{tabular}{r c c c c c c c c c} \hline \hline
**Meters** & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} & \multicolumn{1}{c}{\(S_{final}\)} \\ \hline Water & 4 & 0.008 & ‘auto’ & True & 0.99 & 0.99 & 0.78 & 0.99 & 0.99 & 0.94 \\ Electricity 1 & 2 & 0.05 & 0.3 & False & 0.98 & 0.99 & 0.00 & 0.97 & 0.96 & 0.73 \\ Electricity 2 & 3 & 0.1 & ‘auto’ & False & 0.94 & 0.99 & 0.99 & 0.99 & 0.99 & 0.94 \\ Gas & 3 & 0.05 & 0.1 & True & 0.96 & 0.99 & 0.90 & 0.98 & 0.99 & 0.93 \\ \hline \hline \end{tabular}
\end{table}
Table 5: Best results for each meter with the IF algorithm, according to the proposed metric, among all scenarios and considering the mentioned grid-search.  
were detected, was able to surpass the performance of the IF, for the \"Electricity 2\" and \"Gas\" meters. However, in the \"Water\" meter, the VAE algorithm had the worst score of the presented results. There were also problems of convergence in some scenarios, as mentioned. This indicated the possibility of the algorithm not being sufficiently robust when applied to solutions such as the ones analyzed herein, which needs to be as adaptable as possible over an uncontrolled environment. It was also verified during the tests that the training of VAE models is time-consuming and computationally heavy. This individual computational cost, associated with a high number of hotels, meters, and the more or less frequent (re-)training of the algorithms, could raise additional problems regarding the hardware requirements of the global system. Another reason that did not support the VAE was the large amount of history that must exist for these models to be functional and robust, which could be an impediment to making proper anomaly detection for new meters.