# Assessment of Deep Learning Methodology for Self-Organizing 5G Networks
## 4 Enabling 5G with SON and Deep Learning
### Deep Learning-Based Anomaly Detection
#### 4.2.1 Autoencoders  
An autoencoder is an artificial neural network that is based on the unsupervised learning approach. Autoencoders consist of two parts: the first part is called the encoder, which enables efficient coding \(\mathbf{h}\) of the input data \(\mathbf{x}\), and the second part is the decoder, which generates a reconstruction \(\hat{\mathbf{x}}\) of the input data. A simple depiction of the autoencoder is shown in Figure 2. The function \(f(\mathbf{x})\) maps the input data to the hidden representation or code, and the function \(g(f(\mathbf{x}))\) reconstructs the input data to the output representation. Typically, the encoder and decoder can be represented with the following:  
* encoder: \(\mathbf{h}=f(\mathbf{W}\mathbf{x}+\mathbf{b})\) and
* decoder: \(\hat{\mathbf{x}}=g(\mathbf{W}^{T}\mathbf{h}+\mathbf{c})\),  
where \(\mathbf{b}\) and \(\mathbf{c}\) are biases, and the functions \(f(\cdot)\) and \(g(\cdot)\) are non-linear mapping functions. The training consists of finding parameters \(\Theta=\{\mathbf{W},\ b,\ c\}\) by minimizing the following cost:  
\[\begin{split}\mathcal{L}(\mathbf{x},\hat{\mathbf{x}})=-\sum_{n=1 }^{N}&\left[\mathbf{x}^{(n)}\log(\hat{\mathbf{x}}^{(n)})\right. \\ &\left.\hskip 14.226378 pt+(1-\mathbf{x}^{(n)})\log(1-\hat{\mathbf{x} }^{(n)})\right]\,,\end{split} \tag{1}\]  
which is called the cross-entropy loss. \(N\) is the number of training samples \(\{\mathbf{x}^{(n)}\}_{n=1}^{N}\). The cost of Equation (1) is considered when \(\mathbf{x}\) and \(\hat{\mathbf{x}}\in[0,1]\). In case of linear reconstruction of \(\hat{\mathbf{x}}\), the typical choice is the squared error \(\|\mathbf{x}-\hat{\mathbf{x}}\|^{2}\).  
The autoencoder can be used for cell outage detection in such a way that the model learns to reconstruct the input KPIs. It is important that the hidden layer or the coding layer is smaller than the input layer. This is because if the hidden layer is equal in size to the input layer, then the model will learn the identity function and the output of the model will be a perfect reconstruction. This is also true for case where the hidden layer is of a larger size, which can also lead to the training KPIs being over-fitted. This is also known as an over-complete case. However, it is also possible to add noise to the inputs at the input layer to avoid perfect reconstruction.  
The idea is that if the autoencoder is trained on normal KPIs or data that is not anomalous, then the model will learn to reconstruct the unseen KPIs or test data that is non-anomalous with a low reconstruction error. In contrast, the use of anomalous KPIs would result in a high reconstruction error.  
Figure 2: A simple depiction of the autoencoder with a single hidden layer. The circles represent neurons, and the gray region depicts the layer. The hidden layer size is smaller than the input and output layer sizes. This represents the under-complete case in autoencoders that helps to learn a compressed representation. This type of autoencoder is similar to the non-linear principal component analysis (PCA).  
Therefore, the use of a proper reconstruction error threshold value could help to distinguish between the anomalous and non-anomalous users.