# SmartFog: Training the Fog for the Energy-Saving Analytics of Smart-Meter Data
## 6 Numerical Performance of the Proposed SmartFog  
The goal of this section is threefold. First, we describe the implemented setting for the simulation of the proposed SmartFog platform. Second, we numerically test the accuracy performance of the proposed SDAE of Figure 2 and compare it with the corresponding one of a benchmark solution that uses a shallow Support Vector Machine (SVM) for anomaly detection. Third, we test the energy performance of the SmartFog platform equipped with the proposed AEGA of Algorithm 1 and compare it to the corresponding ones of two benchmark solutions. Specifically, the first benchmark solution performs the mapping of the SDAE layers of Figure 2 onto the SmartFog platform of Figure 1 by resorting to a _non-adaptive_ conventional Elitist GA, while the second one uses only the Cloud node for performing the training of the implemented SDAE of Figure 1.  
_Implemented test framework_--Numerical tests of the SmartFog platform have been carried out by using the UCI \"Individual household electric power consumption\" data set available at: [[https://archive.ics.uci.edu/ml/datasets/individual+household+electric+power+consumption](https://archive.ics.uci.edu/ml/datasets/individual+household+electric+power+consumption)]([https://archive.ics.uci.edu/ml/datasets/individual+household+electric+power+consumption](https://archive.ics.uci.edu/ml/datasets/individual+household+electric+power+consumption)). It embraces more than 2 millions of measurements gathered in a house located in Sceaux (near Paris, France) between December 2006 and November 2010. Instances in the dataset represent the active per-minute energy (in Watt hour) consumed by the household and measured by the SM. From this data set, we have selected 30 days from 10 SMs (43,200 instances) for the train set and 10 days (14,400 instances) for the test set. The number of anomalies in the data set is about 12% of the total. These anomalies consist of time-series representing faulty meters or fraudulent users. The performance of the proposed SmartFog platform was simulated by leveraging the recently proposed VirtFogSim toolbox [9]. It provides several primitives for the customized simulations of virtualized (i.e., clone-based) networked Fog ecosystems. The input provided to the simulated SDAE consists of frames of duration of one, two, four and six hours, which are equivalent to 60, 120, 240 and 360 input units, respectively. A Gaussian noise with zero mean and a variance equal to 1% of the mean squared value of the considered training data was added to the input vector \(\mathbf{x}\), in order to guarantee a robust classification (see Figure 2). We tested two SDAEs with \(L=3\) (3L-SDAE) and \(L=5\) (5L-SDAE) hidden layers and four different lengths of the input vector \(\mathbf{x}\). The number of units in the hidden layers are detailed in Table 1. We used the sigmoid function as nonlinear function in all layers. In the implemented Adam algorithm [4], the learning rate is set to \(\mu=0.001\) for all layers, and the hyper-parameters \(\beta_{1}\) and \(\beta_{2}\)[4]are set to \(\beta_{1}=0.9\) and \(\beta_{2}=0.999\), respectively. For the \(k\)-NN classifier, we have used 5 neighbors and the Euclidean distance as similarity measure. _Comparative accuracy performance_--The obtained numerical results in terms of classification accuracy are reported in Table 2. Accuracy is defined as the ratio between the number of instances correctly classified out the total instances. From Table 2, we can argue that the accuracy decreases when the length of the analysis window is too short or too long: interestingly, a time window of two hours produces the best accuracy. Moreover, we can see that the use of three hidden layers produces better results than five hidden layers. Hence, the 3L-SDAE with a time window of two hours can be considered as the most reliable solution for detecting anomalies in SM data. As a benchmark, a Support Vector Machine (SVM) classifier was trained on the same set of raw data.