# Building Equi-Width Histograms on Homomorphically Encrypted Data
## 3 Evaluation Results
### First Configuration Use Case (UC-1)  
UC-1 assumes the availability of a previously computed histogram of IoT sensor data for the normal behavior of the device. This histogram, along with new IoT sensor data, serves as input for the outlier detection circuit. In this setup, the expected data variance over the selected time interval is a key factor. To account for this, we construct a reference histogram using hourly mean energy measurements recorded over several past days. UC-1 \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Outlier Type (in Figure 5)** & **\# Outliers in Dataset** & **\# Normal Samples** & **\# Outliers Detected by Non-Cryptographic Method** & **\# Outliers Detected by Cryptographic Method** \\ \hline Figure 5a & 3 & 21 & 4 & 4 \\ \hline Figure 5b & 12 & 12 & 9 & 9 \\ \hline Figure 5c & 24 & 0 & 24 & 24 \\ \hline Figure 5d & 22 & 2 & 14 & 14 \\ \hline Figure 5e & 13 & 11 & 12 & 12 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Comparison of outlier detection between non-cryptographic and cryptographic methods performance on various types of outliers. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Data (in Figure 5)** & **Precision \(\frac{TP}{TP+FP}\)** & **Recall \(\frac{TP}{TP+FN}\)** &
\begin{tabular}{c} **F1 Score** \\ \(\frac{2\times Precision}{Precision+Recall}\) \\ \(\frac{2\times Precision}{Precision+Recall}\) \\ \(\frac{2\times Precision}{Precision+Recall}\) \\ \end{tabular} \\ \hline Figure 5a & 0.75 & 1.0 & 0.86 \\ \hline Figure 5b & 1.0 & 0.75 & 0.86 \\ \hline Figure 5c & 1.0 & 1.0 & 1.0 \\ \hline Figure 5d & 1.0 & 0.64 & 0.78 \\ \hline Figure 5e & 1.0 & 0.92 & 0.96 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Performance metrics of our outlier detection method. Figure 7: Configuration use cases for our outlier detection solution. is designed to evaluate the outlier detection circuit independently, focusing on identifying outliers in encrypted data without addressing the construction of the data distribution. In our evaluation, we aim to determine how the size of the plain input data samples affects the size of the encrypted inputs, results, and secret keys. As all the values used in computations are preprocessed to fit in \([0,100]\), they can all be represented using 8 bits. Therefore, when computing the size of the plain inputs, we consider that the size of each value is 1 Byte. Thus, since the measurements are recorded on an hourly basis and each bucket is represented by a tuple containing three values, namely (low, high, count), the size of the clear inputs can be expressed, in bytes, as follows:  
\[sizeof(Data)+sizeof(Histogram)+sizeof(threshold)=24\times\text{No. of days}+3\times\text{No. of buckets}+1 \tag{9}\]  
We measured the variation of the size of encrypted inputs, outputs, and secret keys with the size of the plain inputs, expressed as pairs of number of days considered, each containing 24 measurements, and the number of buckets in the reference histogram used to detect outliers. The actual size of the inputs, expressed in bytes, can be determined using relation 9. The size of the encrypted inputs is correlated to the size of the raw inputs, but the size of the encrypted data is considerably higher. The size of the encrypted output also increases with the size of plain inputs and depends only on the number of measurements to be labeled, as the module outputs an encrypted label associated with each input measurement. However, the size of the secret keys is not correlated with the size of input data, and it has the same order of magnitude, regardless of the size of the inputs. As depicted in Figure 8a, even if the size of the encrypted inputs increases almost linearly with the size of the clear inputs, the overhead introduced by the encryption is significant (\(\times 10^{6}\)). The complexity of the model can be expressed in terms of operations performed during the outlier detection process. This complexity for UC-1 is highly dependent on the size of the input samples.