# Fingerprint-Based Localization Approach for WSN Using Machine Learning Models
## 3 Machine Learning-Based Localization System  
In this section, the development of an efficient WSN-based localization system to position target objects in complex indoor environments is presented. The developed system consists of two main phases: offline and online. In the offline phase, the RSS values, along with the corresponding 2D coordinates, are collected from several reference points in the localization area and saved into a database file (csv file), and then, the collected RSS values are passed into an ML model for training purposes. Figure 2 shows the concept of the offline phase, which includes the collection process of RSS values from several reference points, preprocessing of the RSS values, and then performing the training of an ML process. On the other hand, the online phase includes estimating the target node's position based on the RSS values received from reference nodes. Then, the collected RSS values are preprocessed and fed into a pretrained ML model to estimate the position of the target node. Figure 3 shows the concept of the online phase, which includes the collection of live \begin{table}
\begin{tabular}{p{113.8 pt} p{113.8 pt} p{113.8 pt} p{113.8 pt}} \hline \hline
**Research Work** & **Algorithm** & **Experiment Testbed** & **Localization Accuracy** \\ \hline
[25] & Kalman filter, ridge regression, and vector output & Simulation experiments & Localization error: 2 m \\
[26] & Artificial neural network (ANN) & Real experiments using the CC2530 ZigBee nodes & Localization error: 1.7 m \\
[27] & Voronoi diagram and support vector machine & Simulation experiments—MATLAB & Localization error: 0.3 m \\
[28] & Extreme learning machine & Simulation & Localization error: 2.5 m \\
[29] & Support vector machine & Simulation & Classification rate: 90\% \\
[30] & Layered recurrent neural network & Simulation using real datasets & Accuracy: 93.55\% \\
[31] & Support vector machine with radial basis function kernel & Simulation using real datasets & Localization error: 4 m \\
[32] & Artificial neural network (ANN) & Simulation experiments & Localization error: 6 m \\
[33] & Outlier detection & Simulation experiments & Localization error: 5 m \\
[34] & Neural network ensembles & Simulation experiments & Localization error: 4.5 m \\ \hline \hline \end{tabular}
\end{table} 
Table 1: A comparison between the recently developed AI-based localization systems. Figure 2: The offline phase, which includes gathering of the RSS values and the training process. RSS values from the stationary reference nodes, processing the collected data, and then estimating the mobile target's 2D location (\(x\) and \(y\) coordinates) based on the pretrained ML model. The structure of the collected RSS dataset is presented in Figure 4, where the collected data consists of 6 attributes (4 features and 2 labels). The features set includes the RSS values from 4 different reference nodes, whereas the labels set is the corresponding location of the mobile target node. The adoption of ML algorithms in fingerprinting localization systems improves the localization accuracy of the developed localization system in indoor environments [35]. In general, ML algorithms are designed to predict a single numerical value. However, some ML algorithms support multioutput regression. The presented work is based on predicting multioutput regression, which involves estimating two numerical values (x and y coordinates) for any target node location. Therefore, four ML models were tailored, tested, and adopted in order to enhance the localization accuracy for target nodes employed with a ZigBee communication protocol, as follows:  
* Linear Regression (LR) is the most basic and commonly used category of predictive analysis, where LR investigates the relationship between one dependent variable and one or more independent variables. * K-Nearest Neighbor (KNN) approximates the association between independent variables and the continuous outcome through averaging the observations in the similar neighborhood.