Abstract
Bluetooth positioning is an important and challenging topic in indoor positioning. Although a lot of algorithms have been proposed for this problem, it is still not solved perfectly because of the instable signal strengths of Bluetooth. To improve the performance of Bluetooth positioning, this article proposes a coarse-to-fine positioning method based on weighted K-nearest neighbors and adaptive bandwidth mean shift. The method first employs weighted K-nearest neighbors to generate multi-candidate locations. Then, the testing position is obtained by applying adaptive bandwidth mean shift to the multi-candidate locations, which is used to search for the maximum density of the candidate locations. Experimental result indicates that the proposed method improves the performance of Bluetooth positioning.
Introduction
Recently, location-based service (LBS) has become a hot topic. People have developed many indoor positioning techniques, such as Wi-Fi, 1 RFID, 2 and ZigBee 3 . With the development of Bluetooth 4.0, 4 researchers have shown an increased interest in indoor positioning technology based on Bluetooth.
The most commonly used method in indoor positioning is position fingerprint. 5 Generally, this kind of method has two stages, which are offline training and online testing. In offline phase, some reference locations and corresponding signal strengths are stored in a received signal strength indicator (RSSI) database. Online phase is also known as real-time positioning stage, which matches the testing RSSI with database and returns the testing position.
In this article, we use Beacon 6 as Bluetooth signal source. Figure 1 shows a picture of Beacon. In the positioning process, Beacons emit Bluetooth signals. Users receive these signals by mobile devices. Then, the location is estimated by matching received signals with the fingerprint database. Figure 2 illustrates the localization process in this article.

Picture of beacon.

System architecture of the Bluetooth positioning system.
Classical fingerprint-based localization methods could be classified as probabilistic and deterministic types.
Among all the probabilistic algorithms, Bayes-based positioning algorithm 7 estimates the final location by maximizing posteriori probability that tests RSSI vector matching reference RSSIs. Fras et al. 8 combine weighted K-nearest neighbors (WKNN) with Bayes for a better localization accuracy. Alfakih et al. 9 propose to determine the testing position by approximating the probability distribution of RSSI data using Gaussian mixture model (GMM).
In deterministic algorithms, Rida et al.
10
develop trilateration-based Bluetooth positioning procedure. This method has a low computational complexity and requires less Beacons. However, this model is inaccurate in Bluetooth positioning because of the instable signal strengths. In addition to this method, a series of methods based on nearest neighbor (NN) are proposed, such as K-nearest neighbors (KNN),11–14 WKNN,11,15 and EWKNN (enhanced weighted K-nearest neighbors).
16
These algorithms are efficient in testing phase and have a relative small positioning error. Among these methods, Shin et al.
16
report that EWKNN achieves the best performance by selecting a proper
In fact, because the received Bluetooth signal is instable, it is still challenging to achieve accurate positioning just by Bluetooth RSSI. According to our experiment, although the Bluetooth RSSI vectors drift all the time, the locations generated by classical methods scatter in a small range most of time. We utilize this property in this article, trying to determine a more accurate position based on these scattered locations.
Mean shift 18 is a nonparametric method, which is widely used for searching max density.19–21 It is proposed by Fukunaga and Hostetler. 18 After that, the method is improved in kernel function and weight coefficient. 22 Adaptive bandwidth mean shift (ABMS) 23 is developed from mean-shift algorithm. It calculates an optimal bandwidth in each iteration.
In this article, we propose a coarse-to-fine Bluetooth positioning method, which combines WKNN and ABMS together. In the coarse-positioning phase, WKNN is used to generate candidate positions. Then, in the fine localization procedure, ABMS is used to determine the final position.
The structure of this article is organized as follows. Section “Proposed positioning method” introduces the proposed positioning method. Section “Experimental result and analysis” shows the experimental result and analysis of the proposed method. Finally, the whole article is concluded in section “Conclusion.”
Proposed positioning method
Framework
This section introduces the proposed algorithm which combines WKNN with ABMS. First, in offline phase, all the reference locations and their corresponding Bluetooth RSSIs are stored in a fingerprint database. During the online phase, a smartphone receives RSSIs from different Beacons at a testing point in real time. Then, WKNN is applied to calculate location. Supposing that total

Illustration of the proposed method.
Generating candidate locations by WKNN
Generating single location by WKNN
Let
where
where
In the same way, the RSSIs at reference location
here, because different locations have different counts of scanning times,
The mean vector at reference location
Then, the calculation process 7 of the final location is as follows.
First,
where
Here, we use
Then, the weight
Thus, we can get the weighted Euclidean distance
The final location is calculated by WKNN as follows 24
where
Figure 4 illustrates the positioning process by WKNN (

Illustration of positioning process by WKNN (
Generating multiple locations by WKNN
Since each RSSI vector can produce one location by WKNN. If we use

Real and
Positioning by ABMS
ABMS
Here, the
The classical mean-shift algorithm can search the position with max density. It has a determined parameter of bandwidth. According to our experiment, a proper bandwidth can reduce the estimation error significantly. While if the bandwidth is not proper, mean-shift algorithm may lead to much larger errors.
To solve this problem, ABMS is adopted to calculate flexible bandwidths in the iteration processes. According to Cheng, 22 the new centroid is calculated by following function in each iteration of ABMS
where
There are three kinds of common kernel functions, which are Epanechnikov, Uniform, and Normal. These kernels are all tested in this article (see section “Accuracy”). According to our experiment, Normal kernel is selected in this article.
The profile of Normal function is
where
here,
Positioning by ABMS
The final position is calculated by ABMS on the set of candidate positions, which are obtained by WKNN. The positioning process by ABMS algorithm is given in Algorithm 1.
Figure 6 illustrates the positioning result by WKNN and WKNN+ABMS. The green asterisk shows the real position of the receiver. The red square and pink triangle are obtained positions by WKNN and WKNN+ABMS, respectively. In this figure, we can see that the location obtained by WKKN+ABMS is closer to real position than WKNN.

Illustration of WKNN+ABMS positioning.
Experimental result and analysis
This section introduces the experimental details, result, and analysis.
Experimental details
The experiment is carried out in a computer laboratory of Northeastern University. In this room, 30 Beacons are placed on the ceiling, with a distance of 2 m from each other. The hollow stars in Figure 7 illustrate the distribution of Beacons.

Distribution of beacons.
In the experiment, a smartphone is used to receive Bluetooth signals emitted from Beacons. In offline phase, we select 24 reference locations, as shown in Figure 8, approximating 2 m apart from each other. In the positioning process,

Distribution of reference locations.
Occasionally, there would be some missing data in these recorded RSSI vectors. The missing data is treated as 0 dBm in our experiment. And the corresponding data in training database are also set to be 0.
The positioning steps are given as follows. First, a set of candidate locations for each testing point is generated by WKNN. Because we record
Accuracy
Figure 9 shows the positioning errors of WKNN method with different

Positioning errors of different test locations by WKNN with different
Figure 10 illustrates the impacts of different kernel functions and bandwidths in ABMS. In this figure, the horizontal axis is bandwidth

Positioning errors with different kernel functions and bandwidths.
Figure 11 shows the positioning error with different counts of RSSI vectors (

Positioning errors with different counts of RSSI vectors (
Figure 12 shows the performance comparison of proposed WKNN+ABMS and classical positioning methods. The curves in this figure demonstrate that the proposed method achieves the best performance in all of the tested methods.

Comparison of cumulative distribution of positioning error for different methods.
Table 1 shows some key indicators of positioning error for six different methods. From this table, it can be found that the proposed method has the smallest mean error of 1.3526 m, maximum error of 1.9745 m, and standard deviation of 0.4747 m. And totally, 100.00% of positioning result has a error less than 2 m for the proposed method, which is also the largest in the table.
Positioning error of different methods.
WKNN: weighted K-nearest neighbors; EWKNN: enhanced weighted K-nearest neighbors; ABMS: adaptive bandwidth mean shift.
Bold values represents the performance of proposed method.
Efficiency
The computation time of different methods is given in Tables 2 and 3. The proposed method requires more computing time as can be seen in Tables 1 and 2.
Positioning time of different methods (ms).
WKNN: weighted K-nearest neighbors; EWKNN: enhanced weighted K-nearest neighbors.
Positioning time of WKNN+ABMS with different groups of RSSI vector (ms).
WKNN: weighted K-nearest neighbors; ABMS: adaptive bandwidth mean shift; RSSI: received signal strength indicator.
But the proposed method has its advantages in real applications. Since this method has two steps, which estimate coarse positions by WKNN and determine an accurate position by ABMS. These two steps can be used adaptively to meet the needs of different applications:
If a positioning process requires fast responses, then the localization process can be calculated just using fewer groups of RSSI vectors by WKNN, even just one group of RSSI vector.
If a user keeps static at some place (this can be estimated by sensors of cell phone, such as speed and acceleration sensors), then the positioning result can be calculated more accurately using more groups of RSSI vectors by the proposed WKNN+ABMS method.
What’s more, the proposed model can be used as follows. The target positions are calculated by WKNN without ABMS. When the user keeps static for a while, these calculated positions could be collected directly and processed by ABMS. This process would increase little additional computing time, but it can improve the accuracy of positioning significantly. So, the proposed method is beneficial for real applications.
Conclusion
This article proposes a Bluetooth positioning method based on WKNN and ABMS. First, multiple locations are generated by WKNN. Then, the final position is obtained by ABMS. The experimental result indicates that proposed method achieves a better performance than classical algorithms for Bluetooth positioning.
The main contributions of this article could be concluded as following: (1) This article introduces mean-shift algorithm to positioning problem by searching for max density of candidate locations. (2) To solve the bandwidth problem of mean-shift algorithm, we employ ABMS for final positioning. (3) The method could be used in other positioning problem.
Footnotes
Declaration of conflicting interests
The author(s) declared no potential conflicts of interest with respect to the research, authorship, and/or publication of this article.
Funding
The author(s) disclosed receipt of the following financial support for the research, authorship, and/or publication of this article: This research was partly supported by the Fundamental Research Funds for the Central Universities (N160503003), and the method presented in this article has been applied for patent.
