# Fingerprint-Based Localization Approach for WSN Using Machine Learning Models
## 5 Experimental Results  
This section discusses the results obtained from employing four tailored ML models on three different RSS datasets with various density distributions of reference points. For evaluation purposes, we assessed the following metrics for each ML model:  
1. Mean absolute error (MAE): this refers to the magnitude in difference between the prediction of an observation and the actual value of that observation. The MAE is calculated as follows: \[MAE=\frac{1}{N}\sum\left|Y-Y\right|\] (1) where \(N\) refers to the total number of reference points (test points), \(Y\) refers to the actual reference point, and \(Y\) refers to the estimated location. 2. Standard deviation of MAE: this metric offers a general insight about the developed model. The MAE shows the performance of the ML model, whereas the standard deviation of the MAE shows how efficient the ML model is on the whole dataset. 3. Average localization error (ALE): this refers to the difference between the predicted 2D coordinates and the real 2D coordinates (\(x\) and \(y\)). Therefore, we estimated the localization accuracy for the estimated locations through calculating the difference between the estimated location \((x_{e}-y_{e})\) and the actual location \((x_{r}-y_{r})\), according to the following formula: \[Loc_{Acc}=\sqrt{\left(x_{e}-x_{r}\right)^{2}+\left(y_{e}-y_{r}\right)^{2}}\] (2)  
First, the MAE is assessed for the four ML models using the three different RSS fingerprint datasets. Figure 11 presents the MAE metric for the four ML models using the three datasets (small, medium, and large). As noticed, the LR model offers the best MAE results for the three RSS datasets with an average of 2.2 m, whereas the DT model offers almost the worst MAE results for the three RSS datasets. On the other hand, the RF and KNN models offer reasonable average MAE results compared to the LR model. The obtained detailed results for the tailored MAE model with each single dataset are shown in Table 9.  
The KNN model offers the best MAE results with the large RSS dataset, whereas the RF model achieves the worst MAE score. The LR and DT models came in second and third place, respectively. As noticed below, the decision tree models achieve better MAE results compare to the LR models; this is because that the DT model supports non-linearity data values, such as the issue with the RSS fingerprint dataset. On the other hand, the KNN model achieves a much better MAE score than the LR one, as the KNN is a parametric model. The DT model is faster than the KNN model in real-time scenarios; however, the KNN model achieves a better MAE score compare to the DT model. \begin{table}
\begin{tabular}{l c} \hline \hline
**Parameter** & **Value** \\ \hline Max. depth & 4 \\ Max. leaf nodes & 7 \\ \hline \hline \end{tabular}
\end{table} 
Table 7: Hyperparameter tuning for DT model. \begin{table}
\begin{tabular}{l c} \hline \hline
**Parameter** & **Value** \\ \hline Max depth & 4 \\ n—estimators & 1 \\ Min. sample split & 20 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Hyperparameter tuning for RF model. Third, the localization error was assessed for each ML model using the three RSS fingerprint datasets. For instance, Figure 13 presents the average localization error for each ML model through the adoption of three different RSS fingerprint datasets. As presented below, the KNN model offers the best localization accuracy when adopted with the large RSS dataset, with an average localization error of (1.4 m). On the other hand, the RF model offers the worst localization accuracy with an average of (4.6 m) using the small RSS dataset, whereas the LR and RF models offer reasonable localization accuracy of 2.10 and 2.00 m, respectively, using the small RSS dataset.