## 4 Methodology
### Repeat steps (b) and (c) until convergence.
9

Figure 3: Step-by-step functionality of the proposed BoF-assisted approach. ## 5 Performance Evaluation

In this section, we present a comprehensive performance evaluation of the proposed BoF-based positioning approach, which reveals the positioning accuracy. The experimental results of the proposed BoF indoor positioning model are validated through both simulated virtual and real-time testbeds. We choose two simulation scenarios from our previous work [41, 42], and a personal testbed was set up consisting of two apartments in a residential building. All approaches are run on MATLAB2018a installed on a Dell laptop equipped with an Intel Core i7 processor and 8 GB RAM. Classification of raw RSS data features is carried out through KNN [39, 43], probabilistic [44], SVM [45], DT [46], ensemble learning-based classification model [47], and the discriminant analysis classifier (DAC) [48], and comparisons are made with the proposed BoF-enabled approach. These are the most common machine learning models used in RSS fingerprinting systems [49]. The KNN method estimates labels based on k neighbor samples in the data. SVM separates test data into two categories based on the hyperplane. DAC classifies raw RSS data based on Gaussian distribution. The probabilistic model classifies test data based on the likelihood of training data samples. Ensemble learning uses multiple decision tree models and estimates the test sample class based on majority voting. However, the best results are obtained by integrating KNN classification with the proposed BoF feature extraction approach. To calculate positioning error, Euclidean distance is calculated between estimated position \(P_{Est}\) and actual position \(P_{Test}\) of the test points (TPs). The overall localization accuracy of the system can be given by two performance metrics: mean absolute error (MAE) and cumulative distribution function (CDF) [40]. Let \(N_{TP}\) be the number of TPs; MAE is defined as

\[MAE=\frac{1}{N_{TP}}\sum_{a=1}^{N_{TP}}\sqrt{(P_{Test}-P_{Est})^{2}} \tag{12}\]

The CDF plot displays that the probability of positioning error (PE) is equal to or less than a certain distance. It shows the spread of the positioning errors of TPs and presents the comparison in terms of the proposed approach with various reported methods that have already been mentioned. ### Virtual Environments

The model is validated in a virtual environment including walls and humans. The simulation environments resemble typical application scenes with differently sized rooms and corridors. The first virtual environment has the dimensions of 30 m \(\times\) 30 m with four APs (red squares), while the second simulation scenario has the dimensions of 50 m \(\times\) 50 m with five APs (red squares), as shown in Figures 4 and 5, respectively. Simulations are performed to test the proposed algorithm in realistic and complex indoor environments; both scenarios include multiple rooms, corridors, and halls to match a typical university setting. Random human presence has also been included in both scenarios. In the first scenario, each installed WLAN AP covers the complete area of interest; some areas may have low signal quality. The second scenario considers a large indoor environment, where each AP cannot provide coverage to all RPs. Their coverage is restricted to a certain number of RPs where they can provide localization services. Hence, only a set of installed APs participate in localization. Both simulation scenarios have a grid spacing of 2 m. The RSS values to each RP have been assigned by the extended path loss model with human [50] and wall attenuation factors [51], and 20 samples are observed at each RP from all APs. The WLAN AP configurations for both simulation scenarios can be seen in Table 1, and the simulation parameters are listed in Table 2.

In the offline stage, BoF features are generated by using cluster dimensions of size 2, which leads to a feature dimension of 10 variables for the considered environment of 5 APs.