# Framework for Behavioral Analysis of Mobile Networks
## 3 Proposed Framework
### Training Phase
#### 3.1.1 Cell Patterns Detection Block
Weight vectors of each neuron are used together with the input weight vector following Expression (4), \[E_{D}=\sqrt{\sum_{i=1}^{n}(p_{i}-q_{i})^{2}}\] (4) where \(P=(p_{1},p_{2},p_{3},\ldots,p_{n})\) is the input vector and \(Q=(q_{1},q_{2},q_{3},\ldots,q_{n})\) is each weight vector of the map. The BMU (_Best Matching Unit_) is the minimum distance between all those calculated, so the one with the shortest distance is considered the \"winning neuron\". 2. The \"winning neuron\" must update its weight vector according to the learning rate and the input data vector. 3. Neurons considered as neighbors also update their weight vector. The neighborhood rate determines if a neuron is considered as a neighbor or not as indicated by Expression (5), \[\left\{ \begin{array}{lcl}1&\text{(Neighbour)}&if&D<\sigma_{n}\\ \\ 0&\text{(Not Neighbour)}&if&D>\sigma_{n}\\ \end{array} \right.\] (5) where \(D\) is the distance of each neuron to the winner neuron and \(\sigma\) is the current neighborhood rate. 4. Before starting a new iteration, new values are calculated for the learning and neighborhood rates according to (6) and (7), respectively, \[\alpha=\frac{\alpha(0)}{1+\frac{t}{t}}\] (6) \[\sigma=\frac{\sigma(0)}{1+\frac{t}{t}}\] (7) where \(\alpha(0)\) and \(\sigma(0)\) are the corresponding values of the previous iteration ( for this first iteration these values are the initial values) of learning rate and neighborhood rate, \(t\) is the current iteration and \(T\) is half of maximal iterations allowed. These new values are stored in \(\alpha\) and \(\sigma\) so that new parameters can be used in steps 2 and 3 in the next iteration. Once updated, a new iteration can be started. The execution of the algorithm concludes when the neighborhood and learning rates converge, i.e., if any of these parameters reaches 0, or if the configured maximum number of iterations is reached. The output of the algorithm will be a set of groups representing the different patterns of cells detected, and the cells belonging to each type. Post-processing attempts to find similarities between the cell patterns detected by SOM. This stage is designed with the aim of reducing the initial amount of cell patterns detected by SOM, which may be high when a global vision of the network is required. Taking as reference the weight vectors trained by SOM, a calculation of the Euclidean distances between these weight vectors is performed. These distances are used to establish a threshold that limits which weights vectors are sufficiently similar to be considered the same behavior pattern. The threshold is calculated with Equation (8),  
\[Threshold=a\cdot\mu+b\cdot\sigma^{2}+c\cdot\sigma \tag{8}\]  
where \(\mu\), \(\sigma^{2}\) and y \(\sigma\) are mean, variance and standard deviation of the set of Euclidean distances calculated from the SOM weight vectors, respectively. On the other hand, \(a,b\) and \(c\) are the coefficients that give more or less importance to each statistic in the calculation of the threshold. Once the threshold is computed, the Euclidean distances between each pair of weight vectors are calculated. The pair with the minimum distance is chosen, and it is compared to the threshold. If the distance is lower than the threshold, the neurons merge and a new weight vector is calculated using average values of previous vectors. The process is repeated until the minimum distance found between the neurons is higher than the threshold. From here on, post-processing assigns a label to each behavior pattern, and then it tags each cell with its respective pattern. These associations are stored in a new labeled dataset that can be used by Random Forest in the Cell Patterns Classification block. Finally, the Cell Patterns Detection phase calculates some statistics for each studied KPI, and each cell pattern found after post-processing. Finally, some graphics are plotted to show the identified behavior patterns and their differences. For both, data are organized by cells patterns and information is calculated per pattern.