# Identification of NLOS and Multi-Path Conditions in UWB Localization Using Machine Learning Methods
## 5 Machine Learning Models for Identification of the LOS, NLOS, and MP Conditions
### Random Forest Classifier for the UWB Localization System  
According to the original paper in [46], random forests (RF) are a combination of decision tree predictors in the forest such that each tree depends on the values of a random vector, which is sampled with the independent and identical distribution for all the trees. In brief, RF is built upon multiple decision trees and merges them to get a more accurate and stable prediction as its final output. Two significant advantages of RF are (i) the reduction in over-fitting by averaging several trees and (ii) the low risk of prediction error since RF typically makes the wrong prediction only when more than half of the base classifiers (decision trees) are wrong. The disadvantage, though, is that RF is typically more complex and computationally expensive than the simple decision tree algorithm. In general, the more trees in the forest, the better the prediction. However, this flexibility comes with the cost of the processing time (training and test times), as described in Table 3.  
The prediction accuracy in RF increased steadily as the number of decision trees in the forest increased (Table 3). However, the improvement slowed down when the number of trees in the forest was more than 50 in this particular UWB data. In contrast, the training and test time keep increasing linearly by the increase of the decision trees in the forest. This implied that the training and test  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**Kernel Types** & **Mean Accuracy** & **Mean Training Time** & **Mean Test Time** \\  & **with std (\%)** & **per Sample (\(\upplied\))** & **per Sample (\(\upplied\))** \\ \hline
**Radial basis function (RBF)** & \(\mathbf{82.96\pm 0.14}\) & \(2.06\pm 0.18\) & \(0.99\pm 0.01\) \\ Linear function & \(72.59\pm 0.25\) & \(\mathbf{1.92\pm 0.08}\) & \(\mathbf{0.53\pm 0.01}\) \\
3 rd order polynomial function & \(70.82\pm 0.19\) & \(3.05\pm 0.09\) & \(0.80\pm 0.02\) \\ Sigmoid function & \(50.59\pm 3.05\) & \(3.01\pm 0.27\) & \(1.59\pm 0.09\) \\ \hline \hline \end{tabular} The bold text and numbers in the table refer to the chosen kernel type for the evaluation and the best performance scores for each metric respectively.  
\end{table}
Table 2: Comparison of the SVM configurations based on the kernel functions.  
\begin{table}
\begin{tabular}{c c c c} \hline \hline
**No. of Decision** & **Mean Accuracy** & **Mean Training Time** & **Mean Test Time** \\
**Trees in the Forest** & **with std (\%)** & **per Sample (\(\upplied\))** & **per Sample (\(\upplied\))** \\ \hline
5 decision trees & \(90.91\pm 0.18\) & \(\mathbf{4.84\pm 0.25}\) & \(\mathbf{1.26\pm 0.02}\) \\
10 decision trees & \(91.55\pm 0.09\) & \(9.38\pm 0.27\) & \(2.33\pm 0.08\) \\
20 decision trees & \(91.83\pm 0.10\) & \(18.68\pm 0.52\) & \(4.66\pm 0.08\) \\
30 decision trees & \(91.89\pm 0.11\) & \(27.30\pm 0.41\) & \(6.82\pm 0.13\) \\
**50 decision trees** & \(91.99\pm 0.11\) & \(45.44\pm 0.62\) & \(11.30\pm 0.27\) \\
100 decision trees & \(92.07\pm 0.09\) & \(90.42\pm 1.39\) & \(22.43\pm 0.34\) \\
200 decision trees & \(92.12\pm 0.13\) & \(179.85\pm 3.10\) & \(44.85\pm 0.47\) \\
500 decision trees & \(\mathbf{92.13\pm 0.12}\) & \(460.04\pm 10.27\) & \(113.39\pm 1.44\) \\ \hline \hline \end{tabular} The bold text and numbers in the table refer to the chosen decision trees in the forest for the evaluation and the best performance scores for each metric respectively.  
\end{table}
Table 3: Comparison of the RF configurations based on the numbers of decision trees in the forest.  
times (the smaller the magnitude of the metric, the better the performance) were negatively affected by the growth of trees in the forest. Therefore, a trade-off between the accuracy by growing trees in the forest and the efficiency of the test time should be thoroughly made. In terms of training time, RF performed the fastest among the three classifiers compared to SVM (Section 5.1) and MLP (Section 5.3), i.e., the training time per sample in RF was in the order of microseconds.