# Mobility Classification of LoRaWAN Nodes Using Machine Learning at Network Level
## 4 Experimental Setup
* Kernel, which is the transformation applied to the data samples before the SVM method. It can be linear (linear function), poly- (polynomial function), or rbf (radial basis function). \begin{table}
\begin{tabular}{c c} \hline \hline
**Parameter** & **Values** \\ \hline C & \(\{10^{-2},10^{-1},1,10,10^{2},10^{3},10^{4},10^{5}\}\) \\ kernel & linear, poly, rbf \\ gamma & \(\{0.1,1\}\) \\ degree & \(\{2,3,4\}\) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Parameters used for the grid search of the SVM. Figure 1: Plots of the most representative features of the EDs in the LoRaWAN network: (**a**) std RSSI, (**b**) std SNR, (**c**) mean RSSI, and (**d**) mean SNR. * Gamma, which tunes the shape of the kernel functions. * Degree, which is the degree of the polynomial kernel. It is meaningful only if the kernel is equal to poly-. As we have already anticipated, the classification is performed between the mobile and fixed EDs, because the class of deep indoor EDs has very few nodes. We remark that, for the learning task, we will not use all the features that we have previously extracted, because the more feature we use the bigger the dimensionality of the problem, and then the higher the risk of overfitting the dataset. The reason is that the dataset is too small for the use of complex learning methods. Moreover, not all features are meaningful to extract some patterns from the data, as we can see from Figure 2.  
From repeated tests, we have found that the most representative features for the examples are: mean RSSI, standard deviation of the RSSI, mean SNR, standard deviation of the SNR and mean number of packet transmissions per ED (Figure 3). As a consequence, our samples will have a dimension \(d=5\), which leads to a VC-dimension (see [23]) equal to \(d+1=6\) for the hypothesis set of halfspaces. We remember that the VC-dimension is an important parameter for the learning algorithm, which, if equal to a finite number, guarantees the probably approximately correct (PAC) learnability of the hypothesis class (for more details on this topic please refer to [23]). Because the total number of mobile EDs is small with respect to the number of fixed EDs, we have decided to train the SVM with a special dataset with 120 EDs from each of the two classes. The results are very good and we reach a validation error, equal to 98.05%, and a test error, calculated in the remaining part of the dataset not used for the training part, equal to 99.67%. The best model selected through the grid search is the one with a Gaussian kernel, \(\gamma=1\) and \(C=100\). To get a more precise insight into the precision of the algorithm, we have also created a confusion matrix, which is a specific table layout that allows the visualization of the performance of an algorithm. Each column of the matrix  
Figure 2: Plots of the worst samples’ features. (**a**) RSSI max vs. Var PCKs; see Table 1; (**b**) SNR max vs. Var GW; see Table 1; (**c**) Distinct GW vs. mean GW; see Table 1; (**d**) Var GW vs. Var PCKs; see Table 1.  
represents the instances in a predicted class whereas each row represents the instances in an actual class. The name stems from the fact that it makes it easy to see if the system is confusing two classes. From the confusion matrices in Tables 5 and 6, we can see that the algorithm is quite precise in classifying the nodes, even though it sometimes tends to misclassify some nodes.