# Self-Healing of Semantically Interoperable Smart and Prescriptive Edge Devices in IoT
## 4 Experimental Results
### SEDGE Real-Time Monitoring Test  
TensorFlow Lite (TFL) [51] is an open-source machine learning inference framework, which is the lightweight version of TensorFlow that is specifically designed for mobile/IoT devices and embedded platforms. TFL models are converted into micro models using the TensorFlow Lite converter Python API [52]. The proposed model was developed in the TensorFlow framework and was subsequently converted to a TFL model before being loaded to the RPi. As mentioned in Section 3.6.3, datasets with normal [53] and anomaly points were used for the test phase. Normal monitored edge values are depicted in Figure 15. As it may be observed in this figure, different periods are added for each of the monitored values to observe the sensitivity patterns of all the reported data. As it was difficult to detect anomalies in a normal operation of an RPi, different types of anomalies were simulated based on Table 4. Thus, anomalies in time series were identified based on CPU temperature with values greater than 85\({}^{\circ}\)C, CPU usage with values greater than 70%, virtual memory usage with values greater than 75%, and disk usage with values greater than 85% as well as previous values before the measurements exceeded the defined threshold. Examples of normal and simulated anomalies points are illustrated in Figure 16.  
Table 10 presents the performance of the proposed model in terms of accuracy, precision, and recall as well as F-score. Additionally, a comparison with state-of-the-art models, including AE-LSTM with one layer in the encoder and decoder layer, isolation-forest (IF) [54], one-class SVM (OCSVM) [55], local outlier factor (LOF) [56] and the DBSCAN method [57] are presented. As it can be observed, the model selected in this paper had an accuracy of 0.994 with an F-score of 0.849, a precision of 0.939, and a recall of 0.775, among the highest among the six presented models. Additionally, the execution time was 237 ms, and the total model size was 2.8 Mb. One critical parameter which needs to be considered is the threshold value for the AE-LSTM method and the contamination for the IF, OCSVM and LOF [58]. To determine the threshold value of signals as normal or anomalous, the reconstruction error values were used for the AE-LSTM. As mentioned in Section 3.6.3, the MAE was used in order to detect the anomaly points. The results for each variable (CPU temperature, CPU, usage, disk usage, and virtual memory usage) are presented in Figure 17. The red lines depict the predicted values that are the reconstructed values for each variable, as described in the methodology (Section 3.6.3). In Figure 17, the nearly horizontal lines represent how the Rpi would operate under normal conditions. As it may be observed, the reconstructed/predicted values illustrate accurately the normal Pi conditions. The blue lines illustrate the real values, which were collected from the Rpi (simulated error). Any deviation between those two lines indicates that the retrieved values are an anomaly point, and therefore, they are considered malfunctions. The black marker indicates the real anomaly points, while the red illustrates the predicted anomaly points. Additionally, there are bar plots for each variable, which present the reconstruction error using the MAE metrics as well as lines with the threshold value, which is selected using the three-sigma statistic rule. As it can be observed, the proposed method is able to identify the majority of anomaly points at the beginning of the error phase. Therefore, the selected algorithm is efficient for error detection in an IoT network. Figure 16: Examples of normal-simulated/anomalous data.