# Self-Healing of Semantically Interoperable Smart and Prescriptive Edge Devices in IoT
## 3 SEDGE Proposed Methodology
### Application Layer
#### Long short-term memory networks (LSTM)  
LSTM is a type of recurrent neural network (RNN) which is capable of handling long memory problems. It takes the shape of a series of repeated modules of neural networks, with three control gates in each module: memory cells, memory blocks, and gate units [39]. The different modules of an LSTM are illustrated in Figure 8. LSTM has better long-term information memory than RNN, can learn long-term dependence information, and does not contain the vanishing gradient problem that plagues traditional RNN networks [40]. Like RNN, LSTM reads a series of input vectors \(\mathrm{x}=\left\{x_{1},x_{2},\dots,x_{t},\dots\right\}\), where \(x_{t}\in\mathbb{R}^{m}\) represents an m-dimensional vector of readings for \(m\) variables at time instance \(t\). The first step of an LSTM module is to decide what information will be discarded from the cell state by generating a number within [0, 1]. The procedure is described by the following formula [41]:  
\[f_{t}=\sigma_{1}(W_{f}*[h_{t-1},x_{t}]+b_{f}), \tag{1}\]  
where \(\sigma_{1}\) represents the sigmoid function, \(W_{f}\) is the weight matrices, \(b_{f}\) the bias of the forget gate and \(h_{t-1}\) is the output in state \(t\). The next step of an LSTM is to decide which information is going to be stored in the cell state. The process is split into two parts. The first part includes a sigmoid layer called the \"input gate layer\", \(i\), which decides which values are to be updated. The second includes a tanh layer, which is used to create a vector of new candidate values, \(\hat{C}_{t}\), that \begin{table}
\begin{tabular}{c c} \hline \hline
**Procedure** & **Normal Limits** \\ \hline \multirow{3}{*}{cpu\_temperature} & \(-40\)\({}^{\circ}\)C to \(85\)\({}^{\circ}\)C (Rpi) \\  & \(40\)–\(65\)\({}^{\circ}\)C (Desktop) \\  & \(40\)–\(60\)\({}^{\circ}\)C (Laptop) \\ \hline \hline cpu\_usage\_percent & \(20\)–\(70\)\% \\ \hline virtual\_memory\_usage & \(10\)–\(75\)\% \\ \hline disk\_usage & \(0\)–\(85\)\% \\ \hline network\_usage & N/A \\ \hline number\_of\_processes & N/A \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Procedures to monitor edge performance. Figure 8: A module of LSTM network [34]. could be added to the state. The two parts are combined to create an update to the state. The process is described by formulas [41]  
\[i_{t}=\sigma_{2}(W_{i}*[h_{t-1},x_{t}]+b_{i}), \tag{2}\]  
\[\bar{C}_{t}=tain(W_{c}*[h_{t-1},x_{t}]+b_{c}) \tag{3}\]  
and  
\[C_{t}=f_{t}*C_{t-1}+i_{t}*\bar{C}_{t}, \tag{4}\]  
where \(W_{i}\), \(b_{i}\) and \(W_{c}\), \(b_{c}\) are the weight matrices and the biases of the input gate and the state of the memory cell, respectively. Finally, the output gate is defined [41]:  
\[o_{t}=\sigma_{3}(W_{o}*[h_{t-1},x_{t}]+b_{o}), \tag{5}\]  
\[h_{t}=o_{t}*tain(C_{t}), \tag{6}\]  
where \(W_{o}\) and \(b_{o}\) are the weight matrix and the bias of the output gate. **Autoencoder Network**  
Autoencoder is a neural network that aims to learn a compressed representation from input data. It is an unsupervised method, although it is trained using supervised learning methods, referred to as self-supervised. It consists of input and output layers, encoder and decoder neural networks, and a latent space [42]. The encoder network receives data from the input layer and compresses them into the latent space, whereas the decoder network decompresses them and transmits them to the output layer. The main objective of the autoencoder is to reduce the data dimensions of inputs while maintaining the main information of the data structure. Specifically, using as input \(x\in\mathbb{R}^{m}\), the encoder compresses x to an encoded representation of z = \(e(x)\in\mathbb{R}^{n}\). The decoder reconstructs this representation into an output \(\hat{x}=d(z)\in\mathbb{R}^{m}\).