An F-Score-Weighted Indoor Positioning Algorithm Integrating WiFi and Magnetic Field Fingerprints

,


Introduction
Location-based services (LBSs) have become more popular with the recent advancements in mobile computing technology.One of the critical components of the LBS is positioning systems that can be divided into two categories, namely, outdoor and indoor positioning.Global positioning system (GPS) is a well-known solution in the outdoor environment, whereas it gives poor accuracy in the indoor area since it usually requires line-of-sight (LOS) propagation to obtain acceptable accuracy [1].erefore, an indoor positioning method is required.
Various technologies are developed for solving indoor positioning problem such as global system for mobile communications (GSM) [2], radio-frequency identification (RFID) [3], ultrasonic [4], Bluetooth (BT) [5], wireless fidelity (WiFi) [6], and magnetic field (MF) [7].ese technologies have both advantages and disadvantages depending on their nature and applications.For example, the GSM-based system uses existing infrastructure, but it does not offer reasonable accuracy for indoor areas.RFID-based and ultrasonic-based indoor positioning systems (IPSs) have reasonable accuracies, but they need the installation of additional signals.BT-based IPS has a short operating range and poor predictability.erefore, it is recommended that BT is used as a supplementary technology in an IPS.WiFi-based IPS is the most widely deployed system when compared to other systems.Besides, WiFi-based indoor positioning is preferred to other technologies due to both massive deployments in the indoor area and extensive usage of WiFi-enabled devices.WiFi-based indoor positioning methods have some drawbacks, such that WiFi signals deteriorate over time, which leads to inaccurate position estimates.erefore, the accuracy of only WiFi signals may not be adequate for some applications and can be enhanced using multiple signals.In recent researches, MF-based positioning is also considered as a complementary technique to WiFi-based positioning technology to improve the positioning accuracy.e MF-aided positioning is very popular nowadays since all smartphones include a magnetometer to collect the magnetic data freely when needed.Overall, the positioning performance of each signal type varies depending on the characteristics of the environment.
Considering the variability of the performances of different signal types, an F-score-weighted indoor positioning algorithm, which integrates WiFi-RSS and MF fingerprints, is proposed in this study.In the proposed approach, firstly, positioning is performed by maximum likelihood estimation for both WiFi-RSS and MF signal values to calculate the F-scores of each signal type.en, each signal type is combined using F-score values as a weight to estimate a position.e experiments are performed using the publicly available dataset which contains real-world data [8].e results show that the proposed algorithm is effective and efficient in achieving good indoor positioning accuracy and consolidates the system performance compared to that of just one signal type.e main contributions of this study are that the proposed algorithm considers the environment structure when estimating the position and takes the advantages of two signal types into account at the same time to enhance the positioning performance.
e rest of the paper is organized as follows.Related works for indoor positioning technologies are given in Section 2. Section 3 introduces the preliminaries for the fingerprint-based positioning.e proposed algorithm is given in Section 4. Section 5 provides the experimental work and the related results.Finally, Section 6 includes the conclusions of the work.

Related Works
Several methods have been proposed for positioning in the indoor environment.
ese methods can be classified as triangulation, proximity, pedestrian dead reckoning (PDR), vision analysis, and fingerprinting.Triangulation is a geometric-based method that uses signal parameters to calculate the mobile unit (MU) position [6].e triangulation method suffers from non-line-of-sight (NLOS) conditions; therefore, it gives erroneous results for indoor positioning.In proximity, the MU location is estimated as the antenna position that receives the strongest signal from the MU [9].erefore, a dense grid of antennas with known positions is used.is method is generally used in RFID technology.It requires additional hardware, has low resolution, and has poor accuracy.So, it is impractical for indoor positioning.In PDR, the position of the MU is calculated using the previously calculated position, speed, and the direction of the MU [10].Since the current position is relative to the previous position, the errors are cumulative.Moreover, the sensors in most smartphones do not provide very accurate data.erefore, PDR is not solely adequate for an IPS.Vision analysis has a high complexity since it requires the setup of the large image database and the real-time communication between the server and the MU [11].erefore, it produces an undesirable solution for indoor positioning.
WiFi-received signal strength-(WiFi-RSS-) based fingerprinting method is a widely adopted approach due to its relatively high accuracy and modest cost [12].It utilizes the existing wireless local area network (WLAN) infrastructure.However, it has some challenges such that WiFi-RSS values suffer from the multipath effect, which leads to erroneous position estimate.erefore, it can be enhanced using supplementary technologies such as BTor MF.But, using BT with WiFi-RSS-based fingerprinting method is not a good choice.Since both of the technologies operate at the same frequency (2.4 GHz), the signal inference is inevitable.On the other hand, MF has some advantages such that MF does not suffer from NLOS conditions or multipath effects in indoors and it is easy to obtain MF measurements using today's smartphones.Fingerprinting method can be applied to constitute an MF-based fingerprinting method for indoor positioning [13].However, it has sensitivity to certain materials.Besides, MF strength diminishes rapidly with distance.erefore, an MF-based fingerprinting method is best utilized as a supplementary method to WiFi-RSS-based fingerprinting method for indoor positioning.e positioning accuracy of WiFibased positioning can be enhanced using MF data.A hybrid fingerprint-based positioning, which uses WiFi-RSS and MF values, is proposed in [14,15].ese studies use both signal types to construct a single hybrid fingerprint map for indoor positioning without any weighting.But, the positioning performances of these signal types vary depending on the characteristics of the environment.In this study, concerning the regarding works, two separated fingerprint maps are utilized and integrated with a novel F-score-based weighting approach.
e weights are selected depending on the performance of the individual signal type for a given environment.e details of the proposed works are given in Section 4.

Preliminaries
Fingerprint-based indoor positioning is a widely used method due to several factors such as its easy implementation, low cost, and the promising positioning accuracy.It includes two phases: fingerprint-based mapping (training) and positioning [12].In the fingerprint-based mapping phase, the location dependent characteristics of a signal, which is recorded at reference points (RPs), are stored in a database to form a fingerprint map.In the positioning phase, the mobile unit fingerprint is compared to the fingerprints in the database to estimate the position of the mobile unit.RADAR [16] and HORUS [17] are typical IPS based upon WiFi-RSS-based fingerprinting method.Fingerprint-based indoor positioning is illustrated in Figure 1.
e processes of fingerprint-based mapping and the algorithms used for training and positioning are given in the following subsections.

Fingerprint-Based Mapping.
Fingerprint-based mapping is started with dividing the test area into equal-sized grids; then, signal values are recorded from the center of each grid as a fingerprint.Various studies adopt fingerprint-based indoor positioning in the literature.
ese studies store the 2

Mobile Information Systems
WiFi-RSS values for their database [18,19].Recent studies recognize the e ciency of the MF and store the samples from the magnetometer to setup their database [13,20].Among these databases, the publicly available databases are quite limited [18][19][20].Besides, these databases contain one type of signal measurement.In the previous studies, a multi-signal ngerprint database that includes WiFi-RSS and MF for indoor positioning was proposed [8].In this study, this database is used.e processes of obtaining the ngerprint-based maps are given below.

Radio Map.
Radio map is constructed by dividing the experimental area into equal-sized grids [16].e center of each grid represents the reference points (RPs) where WiFi-RSS values of the radio signals transmitted by APs are collected.ese WiFi-RSS values are stored into the radio map as a ngerprint with the known coordinates of RPs. e ngerprint at the ith RP in the radio map is stored as where FP i is the ngerprint information at RP i , lb i is the label of the RP i , xCoord i and yCoord i are the x and y coordinates of RP i , MAC i,j and RSS i,j are the MAC address and WiFi-RSS values of the jth AP received at RP i , and k i is the number of available APs at RP i .

Magnetic Map.
Magnetic map is established using the same procedure as the radio map construction.Each ngerprint in the magnetic map contains the x, y, and z values of MF strength values that are obtained by a magnetometer sensor on a mobile device [20].Magnetometer sensor returns the x, y, and z values of the MF strength values in relation to the device orientation; therefore, the magnitude of each axis may di er as the device's orientation changes, even when it stays in the same position.So, they must be converted to the world coordinates before being stored in the magnetic map.e accelerometer and gyroscope included on the mobile phone can be used to convert the device orientation to world coordinates.Yaw (ϕ) and pitch (θ) angles obtained from the accelerometer are integrated with heading angle (ψ) from the MF and gyroscope sensors using Kalman lter to obtain the orientation of the mobile device.e orientation angles are used to construct rotation matrix as seen in the following equation: en, the local MF strength measurements are multiplied by the rotation matrix which includes orientation angles to calculate the global MF strength measurements as follows: where B e and B p are the MF strength vectors in the device and world coordinate orientations, respectively.en, using the global values of the MF strength vector (B p ), the magnetic ngerprint at the ith RP in the magnetic map is represented as where MFP i is the magnetic ngerprint information at RP i , lb i is the label of the RP i , xCoord i and yCoord i are the x and y coordinates of RP i , and global i,x , global i,y , and global i,z are the global x, y, and z values of MF strength in relation to the world coordinates at RP i .

Training and Positioning.
e ngerprint-based positioning system usually includes two stages: training and positioning.Given the radio map or magnetic map, a model is constructed in the training phase.In the positioning phase, the model is used to calculate the position of the mobile unit by comparing measurements of the newly obtained data with the recorded ngerprints from the training data.Depending on the application, the ngerprint map can be divided into training and test data.e training data are used to train the model by pairing the input with actual output.Also, the test data can be used for either positioning or evaluating the wellness of the model.
In the literature, various algorithms are used to construct a model for the positioning.In [16], K-nearest neighbour (KNN) is applied to estimate the position.In another study, a decision tree is applied for positioning Mobile Information Systems [21].e target location is predicted using Naïve Bayes (NB) estimate in [17].Maximum likelihood estimation (MLE) is one of the most popular algorithms among them which take the standard deviation of the measurements into account [22].It provides higher accuracy when compared to the other algorithms [23].Additionally, the calculated likelihood values for different signal types are useful for constructing hybrid solutions for the indoor positioning problem.In the MLE algorithm, the probability of obtaining the mobile device fingerprint F ′ at the ith RP whose fingerprint F i is given by where x i and s i are the mean and the standard deviation of the signal measurements at the ith RP, x i ′ is the signal measurement at an unknown location, and n is the dimension of the fingerprint map.e mean and the standard deviation are calculated by where m is the number of collected measurements for the RP i and x j i is the jth measurement from AP i for the radio map.For the magnetic map, x j i is MF strength values as given in (4).e computational cost of ( 5) can be reduced by taking its natural log: Since the second term of ( 7) is constant, it can be ignored.Equation ( 7) is rewritten by multiplying −1 and defining c � ln( s i ) as Now, ( 5) is converted to (8) [24].For the mobile device fingerprint F ′ , (8) is calculated for each RP, and then the label of the RP is returned by calculating Additionally, the wellness of the training model can be evaluated using a separated test data.Model evaluation is carried out as follows: after calculating the estimated position of each test data using (9), the confusion matrix is generated with the estimated position labels and actual position labels.
e confusion matrix is a basis for calculating the terms such as true positive (TP), false negative (FN), true negative (TN), and false positive (FP) [25].e binary case representation of the confusion matrix is given in Table 1.
en, F-score can be calculated using the confusion matrix as follows: In the literature, the F-score values are generally used to evaluate the training model performance using the test data.In this study, the F-score values are used to evaluate the model ( 9) performance for each signal type.Besides, these F-score values are used as the weights of each signal type in the positioning phase to enhance the performance of the indoor positioning system.

The Proposed Algorithm
Traditional fingerprint-based positioning algorithms are initialized with constructing database by collecting measurements from the experimental area.e measurements usually contain only WiFi-RSS values obtained from the APs in the region of interest.RFKON database [8], on the other hand, contains both WiFi-RSS and MF strength values for each RP.
e measurements in the RFKON database are used for constructing radio map and magnetic map, which are explained in the first subsection of Section 2. e radio map and the magnetic map are utilized as inputs for the proposed F-score-weighted indoor positioning algorithm.e pseudocode of the algorithm is given in Algorithm 1.
As seen in the Algorithm 1, the process of the proposed algorithm is started with normalization of data in each map.For this process, max-min normalization method is employed.en, each map is split into training data (60%) and test data (40%) in Step 2 of the training-testing phase.
e test data are used for obtaining F-score weight values of each signal type.In Step 3 of the training-testing phase, the mean and the standard deviation of each signal type are calculated by ( 6) to obtain training model parameters.In the next step, ( 9) is applied to both signal types separately for obtaining estimated RP labels.en, F-score values of each signal type for each RP are calculated using (10).In the last step of training-testing phase, WiFi-RSS-based model (MLE WiFi ) and MF-based model (MLE MF ) are generated for the F-score-weighted indoor positioning.
In the positioning phase, newly obtained WiFi test data, MF test data, and the models are utilized as the inputs.In Steps 1 and 2 of the positioning phase, likelihood values are calculated at each RP for both signal types.en, the final position is estimated using the formula in step 4 of the FP TN TP: when the user is in RP "i" and is classified as RP "i"; TN: when the user is not in RP "i" and is not classified as RP "i"; FP: when the user is not in RP "i" and is classified as RP "i"; FN: when the user is in RP "i" and is not classified as RP "i". 4 Mobile Information Systems positioning phase in Algorithm 1.Note that weight WiFi,i and weight MF,i are the WiFi-RSS and MF F-score weights for ith RP, respectively.Depending on the region of the indoor environment, WiFi signals or MF signals may result in better accuracy for the positioning calculation.en, the corresponding F-score value of the signal will be higher and would be dominant for positioning.

Experimental Work
e proposed method is compared to existing methods in the literature for the test area of RFKON database.e system architecture of our IPS is shown in Figure 2. It contains two major units named as Gezkon and Konsens.Gezkon is a mobile application and it is responsible for collecting WiFi-RSS and MF strength values from the test area.Konsens is a server, which is used to estimate the position of the mobile device and also responsible for updating and calibrating RFKON database.
e communication between Konsens and Gezkon is achieved by sensor nodes through the data distribution service layer.
e details of the test area and experimental results are provided in the following subsections.

Test Area.
e layout of the test area for RFKON database is shown in Figure 3.In this area, real-world indoor localization experiments are conducted to evaluate the performance of the proposed algorithm.e test area is at the Technopark building in Eskisehir Osmangazi University.
e area is divided into grid squares (2.4 m × 2.4 m) and the center of each grid is reported as RP.ere are 20 RPs in the experimental area.e measurements are collected from the 1st floor of this area at each reference point.40 WiFi and 40 magnetic field measurements are collected at each RP for the training and test phases.Hence, 800 measurements are collected for constructing the training set and 800 measurements for the test set.
As seen in Figure 3, there are five sensor nodes, which are represented with small red squares deployed at the locations on the first floor.e red stars represent the RPs used to collect signal measurements from the area.

Experimental Results.
WiFi-RSS values or MF values may provide better positioning accuracy depending on the structure of the indoor area.If there are different fingerprint maps for each signal type, the F-score values can be used to understand accurateness for each map.In our experimental area, F-score values are obtained for radio map and magnetic map as in Figure 4. ose heat maps illustrate the accurateness of positioning in the given RPs.
One can observe from Figure 4(a) that F-scores are relatively high in the upper right regions.at is, WiFi-based positioning offers high performance for these regions.However, F-scores are getting lower in the lower-left regions.In other words, WiFi-based positioning offers lower performance for those regions.In the meantime, the heatmap for MF-based positioning, which is shown in Figure 4(b), offers almost a complementary performance.at is, F-scores are relatively low in the upper right regions and relatively high in the lower-left regions.In the middle regions of the map, both WiFi and MF yield similar performance.erefore, utilizing each signal type with F-score-weighted values concurrently in the proposed positioning algorithm can enhance the performance of the IPS.(1) Normalize each instance in radio map and magnetic map using min-max normalization procedure.
(2) Split the radio map and the magnetic map as training data (60%) and test data (40%).
(3) Use ( 6) to obtain x i and s i for the training data of each signal type.(4) Calculate the RP labels for both test data type using (9) separately.( 5) Apply (10)  Mobile Information Systems e proposed positioning algorithm is compared to KNN algorithm that is used in RADAR [16] and NB algorithm that is used in HORUS [17].e experiments are conducted by comparing KNN, NB, and MLE algorithms using only one signal measurement.erefore, rstly, the proposed algorithm is compared to KNN, NB, and MLE algorithms with WiFi-RSS data.
en, the comparison is carried out when applying KNN, NB, and MLE algorithms with MF data.Figure 5 illustrates the distribution of localization error comparatively.
As shown in Figure 6, the performance of the proposed method is higher than those of the other algorithms when MF strength measurements are used.It is clear from Figures 5 and 6 that the proposed algorithm outperforms the other algorithms for each type of signal measurement.In Table 2, the positioning performances of the respective algorithms are consolidated for each signal type considering a positioning error less than 3 m and 6 m. e proposed algorithm o ers a positioning error less than 3 m for 91% of test data and less than 6 m for 97% of the test data.is performance is far higher than those of the other algorithms.Moreover, the proposed algorithm can e studies [14,15] use WiFi and MF signal types to construct a hybrid ngerprint map for ngerprint-based indoor positioning to enhance the accuracy of their systems.erefore, the proposed algorithm is also compared to MLE, KNN, and NB that use hybrid ngerprint map for positioning.Comparative results are given in Figure 7.
As seen in the gure, all algorithms o er improved performance, thanks to the hybrid ngerprint map.However, the proposed algorithm is still the best when compared to the other algorithms.In Table 3, the positioning performances of the respective algorithms are listed for hybrid data considering a positioning error less than 3 m and 6 m.
ough the performances of the other algorithms are improved with the help of hybrid data, the proposed method still surpasses the others algorithms.

Conclusion
In this study, an F-score-weighted indoor positioning algorithm that combines WiFi and MF ngerprints is proposed.In the rst phase of the proposed method, MLE algorithm is utilized for positioning using WiFi and MF signal values separately to calculate the F-score values of each signal type.en, each signal type is integrated by utilizing F-score values as weights to estimate the nal position.e experiments are conducted using the publicly available dataset containing real-world data.
As a result of the experiments, it is revealed that thepositioning performance of each signal type varies depending on the characteristics of the environment.As given in Test Results section, WiFi and MF signals o er their best performances in di erent parts of the experimental area.Considering the variability of the performances of di erent signal types, the proposed F-score-weighted indoor positioning algorithm, which integrates WiFi-RSS ngerprints and MF ngerprints, o ers the best performance with respect to the other hybrid approaches in the literature.

Figure 7 :
Figure 7: Performances of the indoor positioning algorithms using hybrid ngerprint data.

Figure 6 :
Figure 6: Performances of the indoor positioning algorithms using only MF data.

Table 1 :
Confusion matrix for binary case representation.
(6)calculate the F-score values of each signal type per RP using the calculated RP labels and the actual RP labels.eF-scorevalues are stored as the weight of each signal type as weight WiFi,i and weight MF,i .(6)ConstructWiFi-RSS-based model (MLE WiFi ) and MF-based model (MLE MF ) as follows: MLE WiFi,i � (lb i , xCoord i , yCoord i , x i , s i , weight WiFi,i ), MLE MF,i � (lb i , xCoord i , yCoord i , x i , s i , weight MF,i ).Apply MLE WiFi with (8) using WiFi New Test Data to obtain likelihood values of each RP (p WiFi (F′|F i ), i � 1, . . ., k, where k is the number of RPs).(2) Apply MLE MF with (8) using MF New Test Data to obtain likelihood values of each RP (p MF (F′|F i ), i � 1, . . ., k, where k is the number of RPs).(3) Normalize likelihood values using max-min normalization method to obtain p WiFi (F′|F i ) and p MF (F′|F i ).(4) Use the following equation to calculate the final position: arg min i p WiFi (F′|F i )′ * weight WiFi,i + p MF (F′|F i )′ * weight MF,i .
ALGORITHM 1: Pseudocode of the proposed method.

Table 2 :
Consolidated performances of the indoor positioning algorithms using single signal type.

Table 3 :
Consolidated performances of the indoor positioning algorithms using hybrid data.