Open access peer-reviewed chapter

# Machine Learning Algorithm for Wireless Indoor Localization

By Osamah Ali Abdullah and Ikhlas Abdel-Qader

Submitted: June 12th 2017Reviewed: February 1st 2018Published: September 19th 2018

DOI: 10.5772/intechopen.74754

## Abstract

Smartphones equipped with Wi-Fi technology are widely used nowadays. Due to the need for inexpensive indoor positioning systems (IPSs), many researchers have focused on Wi-Fi-based IPSs, which use wireless local area network received signal strength (RSS) data that are collected at distinct locations in indoor environments called reference points. In this study, a new framework based on symmetric Bregman divergence, which incorporates k-nearest neighbor (kNN) classification in signal space, was proposed. The coordinates of the target were determined as a weighted combination of the nearest fingerprints using Jensen-Bregman divergences, which unify the squared Euclidean and Mahalanobis distances with information-theoretic Jensen-Shannon divergence measures. To validate our work, the performance of the proposed algorithm was compared with the probabilistic neural network and multivariate Kullback-Leibler divergence. The distance error for the developed algorithm was less than 1 m.

### Keywords

• fingerprinting
• indoor localization
• Wi-Fi
• Jensen-Bregman divergence
• probabilistic neural network
• multivariate Gaussian distribution

## 1. Introduction

Automatically, identifying the location of a user has recently become a hot topic in research. The study in [1] estimated that the global indoor localization market is expected to grow from its value of $935.05 million in 2014 to approximately$4.42 billion in 2019, corresponding to an estimated compound annual growth rate (CAGR) of 36.5%. The estimation of mobile locations has an important role in many computing applications. The global positioning system (GPS) is one of the most common location-based systems, but it cannot be used inside buildings as a direct line of sight (LOS) is required between the GPS receiver and the satellite to identify the user’s location. Therefore, a large number of technologies, such as Bluetooth, radiofrequency identification (RFID), wireless local area network (WLAN or Wi-Fi), magnetic field variations, ultrasound, Zigbee, and light-emitting diode (LED) light bulbs, have been developed to create high-accuracy indoor positioning systems (IPS), with Wi-Fi being the most commonly used technology. Most smartphones can obtain received signal strength (RSS) from the access points (APs) of WLANs because of the low cost and existing WLAN infrastructure [2, 3]

The IPS algorithm that uses RSS-based indoor localization can be classified into two main types: log-distance propagation model (PM) algorithms based on the signal and fingerprinting indoor localization based on the data collected. IPS based on signal propagation is divided into lateration and angulation. The main idea of lateration estimation is to calculate the distance between the smartphone and AP using geometry and signal measurement information, such as the time of arrival (TOA), time difference of arrival (TDOA), and angle of arrival (AOA), of the incoming signals from APs. In general, propagation signals suffer from non-line-of-sight (NLOS) multipath signals due to the presence of walls and furniture and the movement of people. In addition, the signal accuracy decreases if one or more AP coordinates are not accurately calculated. All of these drawbacks have made it difficult to estimate an object’s position using signal propagation [4]. Thus, fingerprinting-based localization systems have been proposed as an alternative technology [5] as they do not require infrastructure. Instead, they use the existing WLAN in the building and the smartphone, which relies on the spectrum of the RSS from the APs to the location to estimate the user’s location coordinates.

The fingerprint-based technique is divided into offline and online phases. In the offline phase, the entire area of interest is divided into a rectangular set of grid points, and at each point, a site survey is taken by recording the RSS from APs, which is then stored in a database called the radio map [6, 7, 8, 9, 10]. In the online phase, the smartphone collects the RSS from the APs and sends it to the server to compare the predefined fingerprint of the offline phase with the RSS in the online phase in order to estimate the location on the grid map, as shown in Figure 1.

The k-nearest neighbor (kNN) algorithm is one of the simplest ways to estimate location; it depends upon the Euclidean distance to measure the similarity/dissimilarity between the offline and online phases. Even though this algorithm is easy to implement, it has low accuracy. Other methods such as statistical learning and Bayesian modeling have also been used to estimate the location of an object. Accuracy is one of the most important requirements of IPS.

Mean distance error is typically used as the performance metric and is calculated as the average Euclidean distance between the actual location and the estimated location.

Recently, an important issue was raised about the variation of signal propagation, namely, the question of how signals are able to propagate over time in the same place in the presence of multiple factors, such as physical obstructions, radiofrequency (RF) equipment, and the presence of human bodies. These factors can lead to attenuation and multipath issues, thereby causing gradual changes in the signal that can reduce the accuracy of the localization system [11]. The values stored in fingerprint maps represent the mean value of the received signal strength indicator (RSSI). Some approaches presume that the RSSI distribution is Gaussian [12], whereas others assume a non-Gaussian distribution, such as those described in [13]. Using Wi-Fi localization systems to estimate the location of an object has many advantages compared with other technologies, such as availability and low cost. However, because the RSSI signal uses both offline and online phases, hardware variance can significantly degrade the positional accuracy of these systems. Some studies have investigated this variance; for example, it was reported in [11] that when using different smartphones to collect RSSI data at the same time and same location, some phones consistently had higher RSSI values than others. The orientation of the user can also contribute to the variance of the RSSI signal because the human body can be a significant attenuator.

This hardware variance problem in Wi-Fi localization has also been noticed in Cisco location systems [11]; some signals were found to be omitted when a different device was used in the online phase compared with the offline phase.

This chapter presents the following:

• We propose the use of Jensen-Bregman divergence (JBD) as a WLAN-based method and a Kullback-Leibler multivariate Gaussian (KLMVG) model. The matching stage was performed using probability kernels as a regression scheme.

• We propose a procedure with high characterization distribution. The RSS values were taken from four different orientations (45, 135, 225, and 315°) to prevent body-blocking effects, with a scan performed for 100 s in each direction to reduce the effects of signal variation.

• JBD and KLMVGoutperformed the probabilistic neural network (PNN) and kNN with respect to the accuracy and the average error distance, indicating that the proposed combination scheme is more effective in the sensitive environments of WLAN-based positioning systems.

## 2. Related work

Global navigation satellite systems (GNSS) such as GLONASS (Russia’s version of GPS), GALILEO, and GPS work well in outdoor environments, but their accuracy can significantly decrease in indoor environments due to many factors, such as penetration loss, refraction, multipath propagation, and absorption. Therefore, it is important to develop a system that can work in indoor environments with high accuracy. To this end, many techniques have been proposed for IPS in the last decade. In model-based techniques, the location is estimated based on a geometrical model, such as the log-distance path loss (LDPL) model, in which a semi-statistical function is built on the relationship between the RF propagation function and the RSS value. Several approaches have been proposed that are trade-offs between accuracy and cost, such as TOA, TDOA, AOA, and multidimensional scaling (MDS). MDS is a set of statistical techniques that are used to visualize the information in order to find similarities/dissimilarities in the data. The matrix in MDS begins with item-item dissimilarities, and AP-AP distances are determined by a radio attenuation model [9]. The fingerprinting-based technique depends on matching algorithms (e.g., kNN) that have been used in RADAR [14], which is one of the first Wi-Fi signal strength-based IPS and is considered the basis of WLAN fingerprinting IPS. Many developed kNN algorithms have been proposed for determining the similarity/dissimilarity in metrics, which is usually done using the Manhattan or Euclidean distance, such as in [11, 12, 13, 14, 15, 16, 17, 18]. Ref. [19] proposed a new version of kNN that is more efficient than the probabilistic methods, neural networks, and traditional kNN, as it relies upon the decision tree of the training phases and takes into account the average of reference point (RP) measurements instead of needing the entire dataset to estimate the object’s location. Ref. [20] performed a modified deterministic kNN technique with Mahalanobis, Manhattan, and Euclidian distances and found the Manhattan distance to be the most accurate. Recently, the use of probabilistic distribution measurements in many IPS applications has increased. The authors in [21] pioneered the use of the probabilistic distribution measurement in IPS and proposed a probabilistic framework by using the Bayesian network to estimate the location. In [22] the authors used a modified probability neural network (MPNN) to estimate the coordinates of the object and found that it outperformed the triangulation method. In [23], a kernel method was proposed to estimate the object’s location using a histogram of the RSSI at the unknown location. In [24], the probability density function (PDF) was estimated using the Kullback-Leibler divergence (KLD) framework for composite hypothesis testing between the fingerprinting database and the test point, whereas in [25], the authors assumed that the RSSI distribution was multivariate Gaussian and used the KLD to estimate the impacts of the RPs on the test point in order to estimate the probability of the closest one and to identify the coordinates of the test point.

In [26], the RSS-based Bluetooth low-energy localization technique was used to establish the fingerprint, after which the KLD was used in probabilistic kernel regression to estimate the object’s location. The results showed this method to be accurate to approximately 1 m in an office environment. In general, the KLD kernel regression performs better in a multimodal distribution. In [27], the KLD was used to estimate the probabilistic kernel of both Gaussian and non-Gaussian distributions in order to compare them and to determine their limitations.

## 3. Overall structure of indoor positioning system

We begin with a typical WLAN scenario in which a person carries a smartphone device with WLAN access and takes RSS measurements from different APs within the College of Engineering and Applied Sciences (CEAS) at Western Michigan University (WMU). It is commonly assumed that the RSSI from multiple APs is distributed as a multimodal signal, as noted in [16]. However, in our study, the recorded signal-to-noise ratio for a single device varied significantly at any one location, with the values differing by as much as 10 dBm. Specifically, the signal-to-noise values were recorded for 35 min during rush hour for a single AP and in the same location.

There are many parameters that can affect the shape of the signal, such as reflection, diffraction, and pedestrian traffic. In this study, we sought to find a scenario that would lead to a better distribution of the Wi-Fi signal. During the offline phase, a realistic scenario was created that took into account the variation of the signal. However, because the effects of the body of the person holding the phone as well as pedestrian traffic can change the variation of the signal, a recording of the RSS was taken in four directions (45, 135, 225, and 315°) to reduce these variations. At each RP, a raw set of RSS data were collected as a time sample from the APs in the area of interest, denoted as qi,j°ττ=1..tt=100, where t represents the number of time samples and °is the orientation direction. Next, the average and covariance matrix of the RSS were obtained from the four different directions and ten scans used to create the fingerprinting database, known as the Radio Map, represented by Q°[28]:

Q°=q1,1°q1,2°q1,N°q2,1°q2,2°q2,N°qL,1°qL,2°qL,N°E1

where qi,j°=1qτ=1tqi,j°τand t = 10, which were randomly chosen from the 100 time samples. This allowed us to obtain the average of the RSS samples over time for different APs, i=1,2,..L,j=1,2,.N, where N represents the number of RPs and L is the number of APs. The variance vector of each RP can be defined as

Δj°=Δ1,j°Δ2,j°Δ3,j°..ΔL,j°E2

where

Δi,j°=1t1τ=1tqi,j°τqi,j°2E3

where Δi,j°is the variance for AP i at RP j with orientation °; thus, the database table of the Radio Map is (xj,yj,qj°,Δj°) with qj°defined as

qj°=q1,j°q2,j°q3,j°..qL,j°E4

During the online phase, the RSS measurement is denoted as

pr=p1,rp2,r.pL,rE5

## 4. The Kullback-Leibler multivariate Gaussian (KLMvG) model

Another approach, specifically the KLMvG model, has recently been used in fingerprinting-based methods to estimate the position of the objects. This model exploits the interdependencies between the RPs, such as the signal model and the geometry that can be quantified to find the correlations among the RPs. Milioris [29] proposed a KLMvG model to measure the similarity between the RSS measurements of test points and the RPs, defined as

KLMVG(pqj(°))=12((μq,jSμpS)T(Σj,qs)1(μq,jSμpS)+tr(ΣRs(Σj,qs)1I)ln|Σps(Σj,qs)1|)E6

where S represents the matrix of RSS values from the different APs at specific locations and j represents the cell of the fingerprint location where

Sj°=μj°Σj°E7

μj°is the mean of Jth column of the RSS measurement and Σj°represents the covariance matrix, where Σis the determinant of Σ. Now, using a KLMvG model, we can formulate a probability kernel-based approach. The kernel regression scheme allows us to estimate the PDF of the training datasets and the true positives (TPs) from the online phase that are used to estimate the location of the object. The KLMVGmodel is used to measure the distance between the likelihood of the input sample and the RPs in order to determine which class it belongs to. The RSS distribution can be defined as

Dpq=expKLMVGpqj°2σ2E8

where σ is the kernel smoothing factor. The probability will be equal to 1 if p = q, and the output will decrease when the difference between p and q becomes larger.

The Kullback-Leibler multivariate Gaussian positioning method.

 During the offline phase, RSS measurements are taken at different known locations, and 10 scans with 10 second time delays are used to generate the Radio Map.During the online phase, RSS measurements are taken at unknown locations of the smartphone.During the online phase, the following steps are performed:A database for each RP is set using RSS measurements from different locations.The RSS measurements from the APs of smartphones from unknown locations are set in the same way as the database of the offline phase with respect to the similar media access control (MAC) address.The minimum KLMvG is estimated using Eq. 8.The previous step is repeated for different APs until the minimum distance is obtained.The maximum outputs to the output layer are transferred.

## 5. Bregman divergence algorithm formulation

In recent times, approaches that measure the distortion in classes have become more common, instead of depending on a single distance. Indeed, the analysis of distortion is being used in many applications of machine learning, computational geometry, and IPS. Using Bregman divergence to measure the similarity/dissimilarity has recently become an attractive method because it encapsulates both information-theoretic relative entropy and the geometric Euclidean distance, which is a meta-algorithm [30]. The Bregman distance Dφbetween two sets of convex space data, p = (p1, …, pd) and q = (q1, …, qd), that is associated with φ(defined as a strictly convex and differentiable function) can be defined as

Dφpq=φpφqφppqE9

where ..denotes the dot product:

pq=i=1dpiqi=pTqE10

and φpdenotes the gradient decent operator:

φp=φp1φpdTE11

The Bregman divergence unifies the statistical KLD with the squared Euclidean distance by defining the distortion measurement in classes:

• The Euclidean distance is obtained from the Bregman divergence by considering the convex function as φp=i1dpi2=pp, which is the parabolic potential function in Figure 2.

• The KLD is also a Bregman divergence if the convex function used is φp=i1dpilogpi, which is defined as negative Shannon entropy. The KLD is defined for two discrete distributions as

KLpq=spS=slogpS=sqS=sE12

In information theory, the Shannon differential entropy measures the amount of uncertainty of a random variable:

Hp=plog1pE13

The KLD is equal to the cross entropy of two discrete distributions minus the Shannon differential entropy [31]:

KLpq=sHx(pS=s(qS=sH((pS=sE14

where Hxis the cross-entropy:

Hx(pS=s(qS=s=spS=slog1qS=sE15

and S is the set of vectors of the RSS. In general, the Bregman divergence is not symmetrical, but it can symmetrize as follows:

SDφpq=Dφpq+Dφqp2E16
=12pqφpφqE17

In the same manner, Jeffreys’ divergence symmetrizes the oriented KLD as follows:

Jpq=KLpq+KLqpE18
=Hpq+Hqp(Hp+HqE19
=s(pS=sqS=slog(pS=sqS=sE20

Such information-theoretic divergence has two major drawbacks: first, the output can be undefined if q = 0 and p ≠ 0, and second, the J-divergence is not bound by terms of metric distance. To avoid these drawbacks and avoid the log(0) or to divide by 0, the authors in [32] proposed a new divergence called K-divergence:

Kpq=KLpp+q2E21

By introducing the K-divergence, [30] produced the Jensen-Shannon divergence (JSD) as follows:

JSDpq=12KLpp+q2+KLqp+q2E22
=12Hpp+q2Hp+Hqp+q2HqE23
=12i=1Lpilogpi12qi+12pi+qilogqi12qi+12piE24

The JSD can be defined, bound by an L1-metric, and finite. In the same vein, the Bregman divergence can be symmetrized as

SDφpq=12Dφpq+p2+Dφqq+p2E25
=φp+φqj2φp+qj2E26

for d-dimensional multivariate data:

SDpq=i=1Lφpi+φqi2φpi+qi2E27

where q represents the fingerprint dataset and p, which is the dataset of the test points, represents the APs that the mobile device received. Because φis a strictly convex function and SDpqequals zero if and only if p = q, this family of distortions is termed JSD. The geometric interpretation is represented in Figure 3, where divergence represents the vertical distance between p+q2φp+q2and the midpoint of the segment pφpqφq.

In general, for a positive definite matrix, the Jensen-Bregman divergence contains the generalized quadratic distance, which is known as the Mahalanobis distance:

SDpq=φp+φq2φp+q2=2Qpp+2Qqq2Qp+qp+q4=14Qpp+Qqq2Qpq=14Qpqpq=14pqQ2E28

To improve accuracy, we present Algorithm 2:

The Kullback-Leibler multivariate Gaussian positioning method

 During the offline phase, RSS measurements are taken at different known locations, and 10 scans with 10 second time delays are used to generate the Radio Map.During the online phase, RSS measurements are taken from unknown locations of the smartphone.During the online phase, the following steps are performed:A database for each RP is set using RSS measurements from different locations.The RSS measurements from the APs of smartphones from unknown locations are set in the same way as the database of the offline phase with respect to the similar media access control (MAC) address.The minimum symmetric Bregman divergence is estimated using Eq. 27.The previous step is repeated for different APs until the minimum distance is obtained.The maximum outputs are transferred to the output layer.

## 6. Performance analysis

The proposed algorithm evaluations will be presented in the subsequent subsections; the algorithms were implemented on the first floor of the CEAS at WMU. To collect the data sample, a Samsung S5 smartphone with operating system 4.4.2 was used. The proposed algorithms were implemented on an HP Pavilion using Java software with an Eclipse framework. Cisco Linksys E2500 Advanced Simultaneous Dual-Band Wireless-N Routers were used in the area of interest. Most of this work discounted the variation of the RSS from the APs.

To evaluate the performance of the different fingerprinting techniques, the localization error was computed as the Euclidean distance between the actual reported coordinates of the test points and the coordinates of the mobile user during the online phase. The number of RSS of the APs and the number of nearest neighbors were noted, as they can affect the accuracy of the algorithms. The number of APs can play an important role in the accuracy of the distance error, which can distinguish near RPs from those further away.

To evaluate the performance of the different fingerprinting techniques, the localization error was computed as the Euclidean distance between the actual reported coordinates of the test points and the coordinates of the mobile user during the online phase. The number of RSS of the APs and the number of nearest neighbors were noted, as they can affect the accuracy of the algorithms. The number of APs can play an important role in the accuracy of the distance error, which can distinguish near RPs from those further away.

In order to measure the impact of the APs on the accuracy, we used a specific number of nearest neighbors with a variety of APs. However, that resulted in a longer RSS scanning interval, which slowed the process down. As a result, the online phase comprised five time samples, which took 1 s for Wi-Fi scanning on the device. To investigate the accuracy of our proposed algorithm, different algorithms were used, such as PNN and KNN, and compared with our proposed algorithm. Different numbers of nearest neighbors were used to estimate the location of the object and to evaluate the performance of our system framework.

Figure 4 shows the impact of different APs when five nearest neighbors were used. The lowest localization error was obtained when 22 APs were used: 0.98 m for kJBD, 1.12 m for kJSD, 1.16 m for KLMvG, 1.34 m for PNN, and 1.38 m for kNN. Greater accuracy was obtained when more nearest neighbors were used, as illustrated in Figure 5.

The lowest localization accuracy was also obtained when 22 APs were used: 0.92 m for kJBD, 1.01 m for kJSD, 1.02 m for KLMvG, 1.097 m for PNN, and 1.19 m for kNN. More improvements in system accuracy were noticed when 80 nearest neighbors were used: 0.865 m for kJBD, 0.96 m for kJSD, 0.99 m for KLMvG, 0.995 m for PNN, and 1.12 m for kNN, as shown in Figure 6.

Figure 7 illustrates the corresponding cumulative probability distributions of the localization error for the three methods. In particular, the median errors for kJBD were 0.89 m, 0.98 m for kJSD, and 1.02 m for KLMvG. Furthermore, an accuracy of 90% was achieved at 2.13 m for KLMvG and 1.93 m for kJSD, with the best accuracy obtained at 2.13 m for kJSD.

To validate our work, a comparison was made between the proposed algorithms with other algorithms from prior works, such as kNN [14], compressive sensing [28], and the kernel-based method [33], as illustrated in Table 1.

TechniqueMedian [m]Accuracy 90% [m]
kNN [10]1.83.7
Kernel-based [28]1.63.6
CS-based [27]1.52.7
KLMVG1.022.13
kJSD0.981.93
kJBD0.891.85

### Table 1.

Position error statistic.

## 7. Conclusion

IPS incorporates the power of GPS and indoor mapping and has many potential applications, for example, by emergency healthcare services, by people with impaired vision, and for navigating unfamiliar complex buildings where it is easy to get disoriented or lost (e.g., malls, airports, subways). A fingerprint map was created for a segment of the CEAS in order to utilize the relationship between different RSS readings. Different algorithms were used and compared using different approaches, including kNN and PNN, and their performances assessed for a number of APs. The results were quite adequate for the indoor environment with an average error of less than 1 m. The kJBD had the highest accuracy when there were 80 nearest neighbors with 22 APs. We are currently in the process of investigating position prediction error distributions and quantifying the localization variation of Wi-Fi signal distribution in space

## How to cite and reference

### Cite this chapter Copy to clipboard

Osamah Ali Abdullah and Ikhlas Abdel-Qader (September 19th 2018). Machine Learning Algorithm for Wireless Indoor Localization, Machine Learning - Advanced Techniques and Emerging Applications, Hamed Farhadi, IntechOpen, DOI: 10.5772/intechopen.74754. Available from:

### chapter statistics

1Crossref citations

### Related Content

Next chapter

#### Classification of Malaria-Infected Cells Using Deep Convolutional Neural Networks

By W. David Pan, Yuhang Dong and Dongsheng Wu

First chapter

#### Internet of Things in Emergency Medical Care and Services

By Thierry Edoh

We are IntechOpen, the world's leading publisher of Open Access books. Built by scientists, for scientists. Our readership spans scientists, professors, researchers, librarians, and students, as well as business professionals. We share our knowledge and peer-reveiwed research papers with libraries, scientific and engineering societies, and also work with corporate R&D departments and government entities.

View all Books