An Indoor Pedestrian Positioning Method Using HMM with a Fuzzy Pattern Recognition Algorithm in a WLAN Fingerprint System

With the rapid development of smartphones and wireless networks, indoor location-based services have become more and more prevalent. Due to the sophisticated propagation of radio signals, the Received Signal Strength Indicator (RSSI) shows a significant variation during pedestrian walking, which introduces critical errors in deterministic indoor positioning. To solve this problem, we present a novel method to improve the indoor pedestrian positioning accuracy by embedding a fuzzy pattern recognition algorithm into a Hidden Markov Model. The fuzzy pattern recognition algorithm follows the rule that the RSSI fading has a positive correlation to the distance between the measuring point and the AP location even during a dynamic positioning measurement. Through this algorithm, we use the RSSI variation trend to replace the specific RSSI value to achieve a fuzzy positioning. The transition probability of the Hidden Markov Model is trained by the fuzzy pattern recognition algorithm with pedestrian trajectories. Using the Viterbi algorithm with the trained model, we can obtain a set of hidden location states. In our experiments, we demonstrate that, compared with the deterministic pattern matching algorithm, our method can greatly improve the positioning accuracy and shows robust environmental adaptability.


Introduction
Nowadays, with the rapid development of smartphones and wireless networks, people can conveniently access location-based services (LBSs) with mobile applications. Location information has become the cornerstone of several new technologies and applications including big data, cloud computing, Internet of things, and online-to-offline. The accurate positioning of the users is the key to providing LBS guaranteed by quality of experience (QoE).
The localization technology is mainly divided into outdoors and indoors. The outdoors localization technology is relatively mature, and mainly includes the Global Positioning System (GPS) and cellular positioning systems [1]. However, for indoor localization, GPS signals cannot reach the receivers and the positioning accuracy is too low to support indoor services. For this purpose, people have done a lot of research with different technologies, and developed RFID positioning systems, infrared ray positioning systems, Bluetooth positioning systems, ZigBee positioning systems, ultrasonic positioning systems, vision positioning systems, voice recognition positioning systems, and WLAN (Wireless Local Area Network) fingerprint positioning systems, etc. [2]. Among these, the WLAN fingerprint positioning technology has become a research hotspot in the indoor localization field on account of the popularity of WLAN signals in indoor environments. The WLAN fingerprint system is an economical and practical positioning system. Bahl et al. [3,4] have introduced the basic principle of WLAN fingerprinting. The system workflow is shown in Figure 1. In the off-line phase, users sequentially record Received Signal Strength Indicator (RSSI) values with current position coordinates into a database; this process is often called calibration and the database is called a radio map. In the on-line localization phase, a user enters into a WLAN environment with terminals and samples the RSSI. The user position coordinates are estimated by comparing the RSSI sample against the radio map to determine the closest signal distance.  [2]. Among these, the WLAN fingerprint positioning technology has become a research hotspot in the indoor localization field on account of the popularity of WLAN signals in indoor environments. The WLAN fingerprint system is an economical and practical positioning system. Bahl et al. [3,4] have introduced the basic principle of WLAN fingerprinting. The system workflow is shown in Figure 1. In the off-line phase, users sequentially record Received Signal Strength Indicator (RSSI) values with current position coordinates into a database; this process is often called calibration and the database is called a radio map. In the on-line localization phase, a user enters into a WLAN environment with terminals and samples the RSSI. The user position coordinates are estimated by comparing the RSSI sample against the radio map to determine the closest signal distance. Although there are some classical WLAN fingerprint systems, the research objective is always focused on a static target. There are few papers discussing pedestrian positioning, which is more relevant in a real environment. Due to distance variation and human body interference, the RSSI of moving targets will fluctuate over a large range, especially at a relatively slow speed [5]. Moreover, the sampling time is limited, which means we cannot use the averaging method to reduce the influence of noise because of the too small sample size. The above factors lead to severe distortions in the WLAN fingerprint systems that sample RSSI, thus seriously compromising the positioning accuracy.
In order to offer users LBS services with better positioning accuracy in a real environment, in this paper, a pedestrian positioning method using a Hidden Markov Model (HMM) [6] with a Fuzzy Pattern Recognition (FPR) algorithm in a WLAN fingerprint system is proposed. Firstly, we use the FPR algorithm to rebuild the pre-existing radio map; then, we utilize a forward-backward algorithm to train the HMM using the planned path and the rebuilt radio map; finally, we can utilize a Viterbi algorithm to estimate the pedestrian position using the constructed HMM. This method take full advantage of the prior information of the WLAN fingerprint system and user information (RSSI, Although there are some classical WLAN fingerprint systems, the research objective is always focused on a static target. There are few papers discussing pedestrian positioning, which is more relevant in a real environment. Due to distance variation and human body interference, the RSSI of moving targets will fluctuate over a large range, especially at a relatively slow speed [5]. Moreover, the sampling time is limited, which means we cannot use the averaging method to reduce the influence of noise because of the too small sample size. The above factors lead to severe distortions in the WLAN fingerprint systems that sample RSSI, thus seriously compromising the positioning accuracy. In order to offer users LBS services with better positioning accuracy in a real environment, in this paper, a pedestrian positioning method using a Hidden Markov Model (HMM) [6] with a Fuzzy Pattern Recognition (FPR) algorithm in a WLAN fingerprint system is proposed. Firstly, we use the FPR algorithm to rebuild the pre-existing radio map; then, we utilize a forward-backward algorithm to train the HMM using the planned path and the rebuilt radio map; finally, we can utilize a Viterbi algorithm to estimate the pedestrian position using the constructed HMM. This method take full advantage of the prior information of the WLAN fingerprint system and user information (RSSI, user trajectories), and our experiments indicate that this method can effectively improve the positioning accuracy, consequently improving the user experience. This paper is organized as follows: Section 2 briefly introduces the related work. Section 3 proposes a fuzzy pattern recognition algorithm to improve pedestrian positioning accuracy. Section 4 elaborates on how to train the HMM with the FPR algorithm in the fingerprint system, and use the Viterbi algorithm to estimate pedestrian position. Section 5 describes the experimental testbed and conducts the experiment before the experimental results are analyzed and compared. The last section concludes the research contents in this paper and gives some suggestions of future research.

Related Work
In recent years, research on indoor fingerprint positioning has been conducted actively. We will discuss some representative works here, especially the ones that employ HMM in their systems. To reduce the calibration work, Wallbaum et al. [7,8] employed a radio propagation model and HMM to quickly implement an indoor positioning system. Given some independent assumptions, it uses a discrete probability distribution to describe all hypothetical positions, and this probability distribution is only updated when new RSSI data is collected or the user has moved. The position is estimated by weighing the different hypotheses. This method needs high computation overhead on user terminals, and the accuracy is not good due to the fact the radio propagation model can hardly model realistic environments.
Seitz et al. [9] improve upon the updating method mentioned by Wallbaum et al. [8], and consider the angle factor in the movement updating procedure. Using this method, the proposed HMM directly includes the movement measurements. Although this method could achieve a relatively better positioning accuracy, the experiments were carried out in a clean environment such as a market with no visitors and it was assumed that the fluctuating RSSI followed a Gaussian distribution. It did not consider that there is a mismatch between RSSI measurements in movement and the fingerprint database.
Liu et al. [10] presented a lightweight and robust indoor positioning system. To reduce the calibration work, this system employs a Weibull distribution to represent the distribution of the RSSI over time. Then, it uses an accelerometer sensor to provide the information on the movement distance to calculate the transition probability of the HMM, which will reduce the computational complexity of the positioning process. However, the Weibull distribution cannot accommodate the fluctuating RSSI samples, and the transition probability hardly reflects the real state transition process.
A novel solution named HIPE (Hybrid Indoor Positioning Engine) [11] has applied data fusion to indoor positioning. The HIPE is an engine which fuses the motion dynamics information of a mobile user with the RSSI. Two algorithms are employed in the HIPE, and which one is selected depends on the need for real-time service. The problem with this solution is that the HIPE must install some software on the user's smartphones and this relies on the computational resources of the smartphone. Besides that, the authors do not outline an explicit method to determine the transition probability.
Coleri et al. [12] employed a HMM-based positioning algorithm to position vehicles in constrained routes by exploiting GSM RSSI data. Compared with the previously proposed HMM techniques, their algorithm trains HMM using the driver behavior statistics for the road segments instead of employing the driver behavior as an equal-probability distribution for each of the adjacent reference points (RPs) without any training. They do not take into account that the speed of each movement is different, but rather assume the vehicle is moving with uniform speed on the road segments.

Fuzzy Pattern Recognition Algorithm
In previous studies, there is a simple scheme of pattern recognition in indoor positioning. It is assumed that each position is associated with a unique set of RSSI values, so the distance between a user's measured location and the reference location can be calculated by Equation (1): where s = [s 1 · · · s i ] and r = [r 1 · · · r i ] represent the RSSI vector, respectively, n represents the number of Access Points (APs), d(s, r) represents the Euclidean distance between two locations. The user coordinates are computed by the Euclidean distance from the measured location to all reference locations stored in the radio map, and the RSSI vector with the smallest distance is the nearest location to the true user location. This method is called the Nearest Neighbor (NN) algorithm, and an enhanced method employing the average K nearest RP is called KNN. Both are widely known deterministic pattern matching algorithms.
Although this deterministic pattern matching algorithm with better positioning accuracy can be easily implemented in a WLAN fingerprint system, it is based on an accurate radio map and high precision sampling of RSSI, the latter being almost impossible while people are walking due to the vulnerabilities of the RSSI. Figure 2 shows the fluctuation of RSSI sampling by a user carrying a smartphone walking at different speeds within radio range. Here, we assume that the maximum walking speed is no more than 2 m per second (2 m/s), as mentioned by Alexander et al. [13]. To show that the RSSI variation trend is independent of the device used, we repeated the experiment several times with two APs and two smartphones, both from different vendors. For comparison, the static positioning measurements of RSSI, which are usually stored in the radio map, are also given in the figure. Pu et al. [14] have presented similar results, but collected at a much faster speed.
where s = [s ⋯ s ] and r = [r ⋯ r ] represent the RSSI vector, respectively, n represents the number of Access Points (APs), d(s, r) represents the Euclidean distance between two locations. The user coordinates are computed by the Euclidean distance from the measured location to all reference locations stored in the radio map, and the RSSI vector with the smallest distance is the nearest location to the true user location. This method is called the Nearest Neighbor (NN) algorithm, and an enhanced method employing the average K nearest RP is called KNN. Both are widely known deterministic pattern matching algorithms.
Although this deterministic pattern matching algorithm with better positioning accuracy can be easily implemented in a WLAN fingerprint system, it is based on an accurate radio map and high precision sampling of RSSI, the latter being almost impossible while people are walking due to the vulnerabilities of the RSSI. Figure 2 shows the fluctuation of RSSI sampling by a user carrying a smartphone walking at different speeds within radio range. Here, we assume that the maximum walking speed is no more than 2 m per second (2 m/s), as mentioned by Alexander et al. [13]. To show that the RSSI variation trend is independent of the device used, we repeated the experiment several times with two APs and two smartphones, both from different vendors. For comparison, the static positioning measurements of RSSI, which are usually stored in the radio map, are also given in the figure. Pu et al. [14] have presented similar results, but collected at a much faster speed. Compared with the static positioning measurements, we can see that the RSSI values show significant variations while people are walking due to the sophisticated propagation of the radio Compared with the static positioning measurements, we can see that the RSSI values show significant variations while people are walking due to the sophisticated propagation of the radio signal. The RSSI deviations caused by the different measurement conditions (static or dynamic) will introduce critical positioning errors. Meanwhile, we find that most of the dynamic positioning measurements also follow the propagation and attenuation law, whereby the RSSI fades with the increasing distance between the measuring point and the AP. From this rule, the RSSI variation trend can be used to indicate the relative direction and distance from the initial location to the positioning point. For example, if the RSSI is stronger than at the initial location, it means the positioning point is closer to the AP than the initial location. If there are enough RPs in the area, it can be easily compared to determine the relative locomotion of the pedestrian.
Based on above analysis, we propose a fuzzy pattern recognition algorithm to estimate the pedestrian position, thus reducing the accuracy loss caused by people walking. It uses the RSSI variation trend to replace the actual RSSI value, and the HMM observation state is also indicated by the RSSI variation trend. Relative to the last observation state, RSSI has three main variation trends in HMM, namely, stronger, weaker and flat. To simplify our algorithm, we use the numbers 1, −1, and 0 to respectively represent these three trends. Except for the initial observation state, all the subsequent observation states are indicated by three numbers. For example O (t,t − 1) = (−1, 0, · · · 0, 0, 1, 1, −1), presents the variation of RSSI value at time t compared to time (t − 1) in a localization area that contains n APs. The fuzzy pattern recognition arithmetic steps are as follows: (1) Given an initial RP P 0 in the grid area established via static positioning or user feedback, the RSSI vectors and the position coordinates of P 0 are respectively s t − 1 = (rss 1(t − 1) , rss 2(t − 1) , · · · rss n(t − 1) ) and l t − 1 = (x p0 , y p0 ). (2) Measure RSSI vectors s t = (rss 1t , rss 2t , · · · rss nt ) during pedestrian walking per second, and compare each AP's RSSI of s t with s t − 1 . Considering the signal random disturbance, we give a ±1 dB m threshold to compensate for the influence of RSSI fluctuation. O (t,t − 1) is the comparison result. The pseudo-code of this procedure is shown as follows: there are: s t = (rss 1t , rss 2t , . . . rss nt ); s t -1 =(rss 1(t-1) ,rss 1(t-1) , . . . rss 1(t-1) ) O (t,t − 1) = (o 1 , o 2 , · · · o n ); for(j = 1; j ≤ n; j++) { if (rss jt > (rss j(t − 1) + 1)) o j = 1 else if (rss jt < (rss j(t − 1) − 1)) o j = −1 Else o j = 0 } (3) Compare each AP's RSSI of P 0 with the adjacent RPs in four directions, namely P e , P w , P s and P n .
The position coordinates of the four RPs are l p e , l p w , l p s , l p n . By employing the above method, The results can determine the relative distance from the pedestrian to the four RPs, which can be used to deduce the approximate position of the pedestrian. The pseudo-code of this procedure is shown as follows: there are: l t−1 ,l p e , l p w , l p s , l p n , l p ne , l p se , l p sw , l p nw , l t only equal or approximately equal to one of (O e , O w , O s , O n )) l t = one of (l p e , l p w , l p s , l p n ); l t = one of (l p ne , l p es , l p sw , l p wn ); else l t = l t − 1 ; } else if (O (t,t − 1) equal or approximately equal to three of (O e , O w , O s , O n )) l t = one of (l p e , l p w , l p s , l p n ); The "equal" means all elements in the two vectors are totally equal, and the "approximately equal" means the two vectors have the largest number of identical elements in order. The l p ne , l p es , l p sw , l p wn respectively indicate the northeast, southeast, southwest and northwest RP coordinates (P ne , P es , P sw , P wn ). A more visual description of this algorithm is shown as Figure 3.  The " equal " means all elements in the two vectors are totally equal, and the " approximately equal" means the two vectors have the largest number of identical elements in order. The l , l , l , l respectively indicate the northeast, southeast, southwest and northwest RP coordinates (P , P , P , P ). A more visual description of this algorithm is shown as Figure 3. when the RSSI has no variation or a similar variation in four directions; (c) = when the RSSI variation trend follows the trajectory from P to P ; (d) = when the RSSI has a similar variation trend in the north and east, we assume the RSSI variations follow the trajectory from P to P ; (e) = when the RSSI has a similar variation in the east and west; (f) = when the RSSI has a similar variation in the east, west and north, we assume the RSSI variations follow the trajectory from P to P .  Figure 3. Schematic of the fuzzy pattern recognition algorithm: (a) nine RPs in a grid area and the interval of the RPs is 2 m; (b) l t = l t − 1 when the RSSI has no variation or a similar variation in four directions; (c) l t = l pn when the RSSI variation trend follows the trajectory from P 0 to P n ; (d) l t = l pn when the RSSI has a similar variation trend in the north and east, we assume the RSSI variations follow the trajectory from P 0 to P ne ; (e) l t = l t − 1 when the RSSI has a similar variation in the east and west; (f) l t = l pn when the RSSI has a similar variation in the east, west and north, we assume the RSSI variations follow the trajectory from P 0 to P n . Figure 3 contains all the possible cases of pedestrian movement if we consider the maximum walking speed is no more than 2 m/s, as mentioned above. To estimate the pedestrian position with this algorithm iteratively, we assume that the positioning result is RP P ne in the case of Figure 3d, although it is impossible for people to walk from P 0 to P ne at 2 m/s walking speed. From Figure 3 it is easy to see that the positioning accuracy of the fuzzy pattern recognition algorithm is limited by the interval between RPs. The comparison of positioning results under different measuring conditions (static or dynamic) will be discussed in the later experiments.

Pedestrian Positioning Method Based on HMM
As discussed in Section 2, some researchers employ HMM to implement moving target positioning, but all such approaches more or less have some defects and problems. To make up for the defects and solve the problem, we propose a novel scheme that combines the WLAN fingerprints system with the HMM. To decrease the accuracy loss caused by the vulnerability of WLAN signals, it uses a fuzzy pattern recognition method instead of the deterministic pattern matching algorithm in HMM. It uses the FPR algorithms to train HMM with user trajectories and estimate hidden location states through the Viterbi algorithm.

Mathematical Model of Pedestrian Positioning
The Hidden Markov Model (HMM) is a well-known statistical model which has been successfully applied to acoustic treatment, biological information and natural language processing. Until now, it is still widely used in speech recognition [15]. Different from the traditional Markov model, HMM is a simple dynamic Bayesian network, where there are two kinds of states: hidden state and observation state. The hidden state transition process is a Markov process, and the observation states are generated by hidden Markov processes according to a certain probability distribution [16]. Figure 4 shows the basic architecture of a first-order HMM, where the term l t is the hidden state at time t, o t is the observation at time t, P(l t |l t − 1 ) is the transition probability from l t − 1 to l t , P(o t |l t ) is the conditional probability when the observation is o t in the hidden state l t .  Figure 3 contains all the possible cases of pedestrian movement if we consider the maximum walking speed is no more than 2 m/s, as mentioned above. To estimate the pedestrian position with this algorithm iteratively, we assume that the positioning result is RP P in the case of Figure 3d, although it is impossible for people to walk from P to P at 2 m/s walking speed. From Figure 3 it is easy to see that the positioning accuracy of the fuzzy pattern recognition algorithm is limited by the interval between RPs. The comparison of positioning results under different measuring conditions (static or dynamic) will be discussed in the later experiments.

Pedestrian Positioning Method Based on HMM
As discussed in Section 2, some researchers employ HMM to implement moving target positioning, but all such approaches more or less have some defects and problems. To make up for the defects and solve the problem, we propose a novel scheme that combines the WLAN fingerprints system with the HMM. To decrease the accuracy loss caused by the vulnerability of WLAN signals, it uses a fuzzy pattern recognition method instead of the deterministic pattern matching algorithm in HMM. It uses the FPR algorithms to train HMM with user trajectories and estimate hidden location states through the Viterbi algorithm.

Mathematical Model of Pedestrian Positioning
The Hidden Markov Model (HMM) is a well-known statistical model which has been successfully applied to acoustic treatment, biological information and natural language processing. Until now, it is still widely used in speech recognition [15]. Different from the traditional Markov model, HMM is a simple dynamic Bayesian network, where there are two kinds of states: hidden state and observation state. The hidden state transition process is a Markov process, and the observation states are generated by hidden Markov processes according to a certain probability distribution [16]. Figure 4 shows the basic architecture of a first-order HMM, where the term is the hidden state at time , is the observation at time , ( | ) is the transition probability from to , ( | ) is the conditional probability when the observation is in the hidden state . Employing HMM can effectively improve pedestrian positioning accuracy in a WLAN fingerprint system. The HMM can be mathematically defined as a triple λ = π, A, B which includes three probability matrices, and two sets of states (L, O) in our pedestrian positioning method.
L is the location space, L = l , l , ⋯ , l , l , (1 ≤ i ≤ N), each state represents a reference grid point with coordinates in the localization area [17], N is the total number of points.
, each state represents a RSSI variation trend vector in a location state, M is the total number of possible vectors. The vector has three kinds of symbol, namely 1, 0, −1, which are respectively presented as z , z , z . π is an initial location state probability distribution, π = P(l ) (l ∈ L) is the probability of state l . Here, we assume that π follows a uniform probability distribution. Employing HMM can effectively improve pedestrian positioning accuracy in a WLAN fingerprint system. The HMM can be mathematically defined as a triple λ = {π, A, B} which includes three probability matrices, and two sets of states (L, O) in our pedestrian positioning method.
L is the location space, L = {l 1 , l 2 , · · · , l N }, l i , (1 ≤ i ≤ N), each state represents a reference grid point with coordinates in the localization area [17], N is the total number of points.
V is the observation signal space, V = {v 1 , v 2 , · · · , v M }, v j , (1 ≤ j ≤ M), each state represents a RSSI variation trend vector in a location state, M is the total number of possible vectors. The vector has three kinds of symbol, namely 1, 0, −1, which are respectively presented as z −1 , z 0 , z 1 .
π is an initial location state probability distribution, π = P(l i ) (l i ∈ L) is the probability of state l i . Here, we assume that π follows a uniform probability distribution.
, a ij is the probability of the transition from location l i to location l j , thus there is ∑ N j = 1 a ij = 1(0 ≤ a ij ≤ 1). Because of the limitation of pedestrians' walking speed (i.e., 2 m/s), if we divide the location area into 2 m × 2 m grids, we can consider that the transition probability is only valid between the adjacent grids, and the transition probability is zero in the case of cross grids. The transition probability of HMM is time invariant, so P(L t = l t ) solely depends on the last location state l t − 1 .
B is a confusion matrix, is the emission probability when the RSSI variation trend is v k in location l i at time t, thus there is Here, we assume that the emission probability solely depends on the location state at time t.

Pedestrian Positioning Using Viterbi Algorithm
Given a set of RSSI variation trends, V = {v 1 , v 2 , · · · , v M } and a settled HMM λ = {π, A, B}, the hidden location sequence L = {l 1 , l 2 , · · · , l N } can be estimated by employing the Viterbi algorithm. The Viterbi algorithm is proposed on the basis of dynamic programming for finding the optimal hidden state sequence [18]. The observed RSSI variation trends and the possible location transition are shown as a trellis in Figure 5.
into 2 m × 2 m grids, we can consider that the transition probability is only valid between the adjacent grids, and the transition probability is zero in the case of cross grids. The transition probability of HMM is time invariant, so P(L = l ) solely depends on the last location state l . B is a confusion matrix, B = b (k) = P ( v |l ) (v ∈ O, l ∈ L) , b (k) is the emission probability when the RSSI variation trend is v in location l at time t , thus there is ∑ b (k) = 1 (0 ≤ b (k) ≤ 1). Here, we assume that the emission probability solely depends on the location state at time t.

Pedestrian Positioning Using Viterbi Algorithm
Given a set of RSSI variation trends, V = v , v , ⋯ , v and a settled HMM λ = π, A, B , the hidden location sequence L = l , l , ⋯ , l can be estimated by employing the Viterbi algorithm. The Viterbi algorithm is proposed on the basis of dynamic programming for finding the optimal hidden state sequence [18]. The observed RSSI variation trends and the possible location transition are shown as a trellis in Figure 5.
To find the most likely sequence of the location, i.e., marking the path of the actual location transition in Figure 5, the Viterbi algorithm will be manipulated through four procedures as follows: Initialization, Recursion, Termination, and Path Backtracking [10]. Since there are a lot of resources describing the algorithm, it will not be covered here.
Through the procedures, we can learn that the transition probability has an important role in the Viterbi algorithm. Not only is the computation complexity of the Viterbi relative to the transition probability, but also the positioning accuracy is dependent on the transition probability. So far, the problem has been centered on how to calculate the transition probability.

Employing the FPR Algorithm to Estimate the Transition Probability
Transition probability is the most critical parameter in the pedestrian positioning model. The positioning accuracy of the Viterbi algorithm depends on the precision of the transition probability. To obtain the transition probability which can reflect the pedestrian walking pattern, we utilize the FPR algorithm to estimate the transition probability using a rebuilt radio map and planned path.
The pre-existing radio map stored the RSSI and the corresponding position coordinates. To reduce the RSSI deviation caused by different measurement conditions, we use the fuzzy pattern To find the most likely sequence of the location, i.e., marking the path of the actual location transition in Figure 5, the Viterbi algorithm will be manipulated through four procedures as follows: Initialization, Recursion, Termination, and Path Backtracking [10]. Since there are a lot of resources describing the algorithm, it will not be covered here.
Through the procedures, we can learn that the transition probability has an important role in the Viterbi algorithm. Not only is the computation complexity of the Viterbi relative to the transition probability, but also the positioning accuracy is dependent on the transition probability. So far, the problem has been centered on how to calculate the transition probability.

Employing the FPR Algorithm to Estimate the Transition Probability
Transition probability is the most critical parameter in the pedestrian positioning model. The positioning accuracy of the Viterbi algorithm depends on the precision of the transition probability. To obtain the transition probability which can reflect the pedestrian walking pattern, we utilize the FPR algorithm to estimate the transition probability using a rebuilt radio map and planned path.
The pre-existing radio map stored the RSSI and the corresponding position coordinates. To reduce the RSSI deviation caused by different measurement conditions, we use the fuzzy pattern recognition algorithm to rebuild the pre-existing radio map. A comparison of the two kinds of radio maps is shown in Figure 6.
Sensors 2016, 16, 1447 9 of 20 recognition algorithm to rebuild the pre-existing radio map. A comparison of the two kinds of radio maps is shown in Figure 6.
(a) (b) Figure 6. The comparison of two kinds of radio maps: (a) the pre-exiting radio map; (b) the reconstructive radio map.
The left part of Figure 6 is a traditional radio map, where to keep things simple, we only give RSSI values of one AP in the radio map. The right part is the new radio map which is rebuilt by comparing the RSSI variation trend between RP and its adjacent RPs in four directions. Correspondingly, the HMM observation signal space also changes from the RSSI value to the RSSI variation trend.
In indoor areas, people will follow certain rules in moving, such as a limited walking speed, that there is no way through the walls, and that they walk in a straight line in a corridor. Using these rules, we can reasonably plan the user's path, and use these trajectories as the HMM training samples so as to effectively improve the positioning accuracy. For training the HMM with the FPR algorithm, a set of consecutive RSSIs are recorded by volunteer sampling along the planned path. The planned path should contain all the RPs [17], so it will be able to obtain higher positioning accuracy. Because the FPR algorithm is sensitive to the direction of pedestrian travel, multiple training trajectories are provided in all four directions, as well.
As mentioned before, the pedestrian locomotion is limited to a certain walking speed (2 m/s in this study) in an indoor environment. Figure 7a demonstrates that, after a sampling period (one second in this study), the next location can only be within a circle with a radius of two meters. If we collect the training sample at approximately the maximum speed and we set the RPs' interval as equal to the maximum speed, the transition probability can be estimated through the FPR algorithm.
The main goal of the FPR algorithm is to consider the adjacent RPs as the possible pedestrian locations in the next state, as shown in Figure 7b.
is the set of RSSI values along the planned path, and M is the number of the RPs along the path. It is obvious that v is a RSSI sampling value at the position of RP . The transition probability from RP to the adjacent RPs can be estimated as follows: (1) Compare the v and v using the FPR arithmetic step two. The O ( , ) is the comparison result.  The left part of Figure 6 is a traditional radio map, where to keep things simple, we only give RSSI values of one AP in the radio map. The right part is the new radio map which is rebuilt by comparing the RSSI variation trend between RP and its adjacent RPs in four directions. Correspondingly, the HMM observation signal space also changes from the RSSI value to the RSSI variation trend.
In indoor areas, people will follow certain rules in moving, such as a limited walking speed, that there is no way through the walls, and that they walk in a straight line in a corridor. Using these rules, we can reasonably plan the user's path, and use these trajectories as the HMM training samples so as to effectively improve the positioning accuracy. For training the HMM with the FPR algorithm, a set of consecutive RSSIs are recorded by volunteer sampling along the planned path. The planned path should contain all the RPs [17], so it will be able to obtain higher positioning accuracy. Because the FPR algorithm is sensitive to the direction of pedestrian travel, multiple training trajectories are provided in all four directions, as well.
As mentioned before, the pedestrian locomotion is limited to a certain walking speed (2 m/s in this study) in an indoor environment. Figure 7a demonstrates that, after a sampling period (one second in this study), the next location can only be within a circle with a radius of two meters. If we collect the training sample at approximately the maximum speed and we set the RPs' interval as equal to the maximum speed, the transition probability can be estimated through the FPR algorithm.
The main goal of the FPR algorithm is to consider the adjacent RPs as the possible pedestrian locations in the next state, as shown in Figure 7b. V = {v 1 , v 2 , · · · , v M } is the set of RSSI values along the planned path, and M is the number of the RPs along the path. It is obvious that v i is a RSSI sampling value at the position of RP i . The transition probability from RP i to the adjacent RPs can be estimated as follows: (1) Compare the v i and v i + 1 using the FPR arithmetic step two. The O (i,i + 1) is the comparison result. O (i,i + 1) = (y 1w , y 2w , · · · y nw ); O s O (i,i + 1) = (y 1s , y 2s , · · · y ns ); O n O (i,i + 1) = (x 1n , x 2n , · · · x nn ); N c = The number of zeros of O (i,i + 1) ; N e = (y 1e + y 2e + · · · + y ne ); N w = (y 1w + y 2w + · · · + y nw ); N s = (y 1s + y 2s + · · · + y ns ); N n = (y 1n + y 2n + · · · + y nn ); (4) If there are multiple training trajectories from other directions, we use the above steps to estimate the transition probability from other directions, and the final results are the arithmetic means of the transition probability from different directions. In this way, we use the FPR algorithm to estimate the transition probability, which provides strong support for the pedestrian positioning with the Viterbi algorithm. ; N e = (y 1e + y 2e + ⋯ + y ne ); N w = (y 1w + y 2w + ⋯ + y nw ); N s = (y 1s + y 2s + ⋯ + y ns ); N n = (y 1n + y 2n + ⋯ + y nn ); N sum = N c + N e + N w + N s + N n ; P c = P (L t + 1 = RP i |L t = RP i ) =

Positioning Experiments and Results
To validate our algorithm and method, we perform some experiments in two real indoor environments. The first scenario is an office area located on the fourth floor of the YiFu building, and the second scenario is an open area located in the library.

Positioning Experiments and Results
To validate our algorithm and method, we perform some experiments in two real indoor environments. The first scenario is an office area located on the fourth floor of the YiFu building, and the second scenario is an open area located in the library.
To meet the needs of our experiment, the RSSI collection was performed using a Samsung S5 smartphone, in which the API supports scanning the RSSI with an interval of one second. If not otherwise specified, all measurements are collected with this smartphone. During the offline phase, we have taken a series of measures to improve the RSSI measurement accuracy. To mitigate the impact of the distribution difference of RSSI in different directions, we collected the measurements in four directions. Then, we collected 40 measurements at each reference point to decrease the random noise effects (thus 10 samples for each direction). Finally, we conducted the collection at midnight to avoid the interference caused by walking people. In the experiments, we mainly use the cumulative distribution function of error (CDF) and root mean square error (RSME) to calculate the positioning error.

Performance Evaluation in an Office Building
This office area includes a horizontally H-shaped corridor and some rooms, as shown in Figure 8. For the purposes of simplifying the experimental procedure, we only chose the corridor area, which has a dimension of 37.7 m × 13.8 m for localization. There are a total of 13 APs on this floor, four of them are RG-AP220-E APs which are deployed in the ceiling; the rest of the nine household APs are produced by different manufacturers, which are deployed in the different offices. The rough position of the APs is shown in Figure 8 as a wireless symbol. Due to the high-density deployment of the APs on the floor, almost all the localization area can receive 13 signals from the different APs. If there is an area where the signal cannot be received at that moment, it will be recorded as −99 dBm. The whole corridor area has been divided into 48 uniform 2 m × 2 m grids, and the reference point is the center of each grid.
To meet the needs of our experiment, the RSSI collection was performed using a Samsung S5 smartphone, in which the API supports scanning the RSSI with an interval of one second. If not otherwise specified, all measurements are collected with this smartphone. During the offline phase, we have taken a series of measures to improve the RSSI measurement accuracy. To mitigate the impact of the distribution difference of RSSI in different directions, we collected the measurements in four directions. Then, we collected 40 measurements at each reference point to decrease the random noise effects (thus 10 samples for each direction). Finally, we conducted the collection at midnight to avoid the interference caused by walking people. In the experiments, we mainly use the cumulative distribution function of error (CDF) and root mean square error (RSME) to calculate the positioning error.

Performance Evaluation in an Office Building
This office area includes a horizontally H-shaped corridor and some rooms, as shown in Figure 8. For the purposes of simplifying the experimental procedure, we only chose the corridor area, which has a dimension of 37.7 m × 13.8 m for localization. There are a total of 13 APs on this floor, four of them are RG-AP220-E APs which are deployed in the ceiling; the rest of the nine household APs are produced by different manufacturers, which are deployed in the different offices. The rough position of the APs is shown in Figure 8 as a wireless symbol. Due to the high-density deployment of the APs on the floor, almost all the localization area can receive 13 signals from the different APs. If there is an area where the signal cannot be received at that moment, it will be recorded as −99 dBm. The whole corridor area has been divided into 48 uniform 2 m × 2 m grids, and the reference point is the center of each grid.
After the radio map of this office area has been built, we can perform the experiments. The measurements are collected by a user walking alone the planned paths at about 1.5 m/s. The planned paths are shown in Figure 8 as a yellow line and red line, respectively. Both of them are 46 m long; that means we can collect 60 measurements while the user is walking at a speed of about 1.5 m/s. We estimated the user position by three methods, namely the KNN algorithm (k = 8), the probabilistic location (PL) [19,20] algorithm and the fuzzy pattern recognition algorithm, respectively. The estimated positions of the user are shown in Figure 9.  After the radio map of this office area has been built, we can perform the experiments. The measurements are collected by a user walking alone the planned paths at about 1.5 m/s. The planned paths are shown in Figure 8 as a yellow line and red line, respectively. Both of them are 46 m long; that means we can collect 60 measurements while the user is walking at a speed of about 1.5 m/s. We estimated the user position by three methods, namely the KNN algorithm (k = 8), the probabilistic location (PL) [19,20] algorithm and the fuzzy pattern recognition algorithm, respectively. The estimated positions of the user are shown in Figure 9.  Figure 9c shows that the estimated positions are punctuated clearly and accurately at the reference points along the planned path. That is because the path just passes through the RPs, and the FPR algorithm selects the adjacent RPs as the candidate pedestrian position. Actually, the performance of the FPR algorithm is better than that of the other algorithms but it is not as strong as Figure 9 shows. To fairly compare the positioning error, Figure 10 shows the experimental results of RMSE, minimum error, maximum error and cumulative error probability of the different positioning algorithms. Obviously, the FPR algorithm performs better than the KNN and PL algorithm. The RMSE and the minimum error of the FPR algorithm are both minimal, but the maximum error of the FPR algorithm is greater than that of the PL algorithm. This is because the FPR algorithm introduces an accumulating error with each positioning process when direction-hopping happens. The From Figure 9, we can clearly see that because of the RSSI deviations caused by the different measuring conditions (static or dynamic), the estimated positions present a cloud-like pattern in Figure 9a,b. That means there are lots of ambiguities in the results when we use the KNN algorithm and PL algorithm. Unlike the two left figures, Figure 9c shows that the estimated positions are punctuated clearly and accurately at the reference points along the planned path. That is because the path just passes through the RPs, and the FPR algorithm selects the adjacent RPs as the candidate pedestrian position. Actually, the performance of the FPR algorithm is better than that of the other algorithms but it is not as strong as Figure 9 shows.
To fairly compare the positioning error, Figure 10 shows the experimental results of RMSE, minimum error, maximum error and cumulative error probability of the different positioning algorithms. Obviously, the FPR algorithm performs better than the KNN and PL algorithm. The RMSE and the minimum error of the FPR algorithm are both minimal, but the maximum error of the FPR algorithm is greater than that of the PL algorithm. This is because the FPR algorithm introduces an accumulating error with each positioning process when direction-hopping happens.  Figure 11 shows the experimental results of the positioning error using the FPR algorithm when the pedestrian walks at different speeds. In the case where the pedestrian speed is no more than 2 m/s, the dynamic positioning error only fluctuates slightly at different speeds, and the positioning error is smaller when the speed is approaching 2 m/s. When the pedestrian speed is 3 m/s, the positioning error becomes larger. The main factor is that when the distance a pedestrian walks in a second is more than the RPs' interval-and the distance a pedestrian moves may span one or two grid areas-the FPR algorithm has difficulties to distinguish the real position because it only considers the RSSI variation trend, and this ambiguity will also accumulate in each positioning process and finally bring about a large positioning error.  Figure 12 shows the positioning error of the proposed FPR algorithm at uniform and variable speeds. When the variable speed range is less than or equal to 2 m/s, the positioning error is slightly worse than at the uniform speed of 2 m/s. Otherwise, the positioning accuracy will decrease rapidly. From Figures 11 and 12, we know that FPR algorithm offers better accuracy when the pedestrian walking speed is no more than the RPs' interval per second (here is 2 m/s), either at uniform or  Figure 11 shows the experimental results of the positioning error using the FPR algorithm when the pedestrian walks at different speeds. In the case where the pedestrian speed is no more than 2 m/s, the dynamic positioning error only fluctuates slightly at different speeds, and the positioning error is smaller when the speed is approaching 2 m/s. When the pedestrian speed is 3 m/s, the positioning error becomes larger. The main factor is that when the distance a pedestrian walks in a second is more than the RPs' interval-and the distance a pedestrian moves may span one or two grid areas-the FPR algorithm has difficulties to distinguish the real position because it only considers the RSSI variation trend, and this ambiguity will also accumulate in each positioning process and finally bring about a large positioning error.  Figure 11 shows the experimental results of the positioning error using the FPR algorithm when the pedestrian walks at different speeds. In the case where the pedestrian speed is no more than 2 m/s, the dynamic positioning error only fluctuates slightly at different speeds, and the positioning error is smaller when the speed is approaching 2 m/s. When the pedestrian speed is 3 m/s, the positioning error becomes larger. The main factor is that when the distance a pedestrian walks in a second is more than the RPs' interval-and the distance a pedestrian moves may span one or two grid areas-the FPR algorithm has difficulties to distinguish the real position because it only considers the RSSI variation trend, and this ambiguity will also accumulate in each positioning process and finally bring about a large positioning error.  Figure 12 shows the positioning error of the proposed FPR algorithm at uniform and variable speeds. When the variable speed range is less than or equal to 2 m/s, the positioning error is slightly worse than at the uniform speed of 2 m/s. Otherwise, the positioning accuracy will decrease rapidly. From Figures 11 and 12, we know that FPR algorithm offers better accuracy when the pedestrian walking speed is no more than the RPs' interval per second (here is 2 m/s), either at uniform or  Figure 12 shows the positioning error of the proposed FPR algorithm at uniform and variable speeds. When the variable speed range is less than or equal to 2 m/s, the positioning error is slightly worse than at the uniform speed of 2 m/s. Otherwise, the positioning accuracy will decrease rapidly. From Figures 11 and 12, we know that FPR algorithm offers better accuracy when the pedestrian walking speed is no more than the RPs' interval per second (here is 2 m/s), either at uniform or variable walking speed. The initial position of each estimation is replaced iteratively by adjacent RPs in the FPR algorithm, which can easily compensate for errors of less than the RP interval, but it cannot decrease the error accumulation caused by walking too fast.
Sensors 2016, 16,1447 14 of 20 variable walking speed. The initial position of each estimation is replaced iteratively by adjacent RPs in the FPR algorithm, which can easily compensate for errors of less than the RP interval, but it cannot decrease the error accumulation caused by walking too fast.
(a) (b) To test the adaptability of the FPR algorithm to different devices, we used a XIAOMI HM2 and an iPhone 4S (IOS 6.1.3, Apple, Cupertino, CA, USA) to repeat the experiments. There was little change in the positioning error, which means the FPR algorithm has good adaptability to different smartphones, as can be seen in Figure 13. From the above experimental results, we can see that the FPR algorithm can offer better positioning accuracy over a certain range of speeds and has good adaptability to different devices, but it also has two drawbacks: one is that its positioning accuracy is limited by the RP interval, the other is the accumulating positioning error when direction-hopping is happening.
In the HMM method testing, the red line and the yellow line are treated as the model training trajectories, and the walking path is the green line as shown in Figure 8. We use the FPR algorithm to estimate the transition probability with the measurements collected at the speed of 2 m/s from two directions, one time from east to west, and the other time from west to east. To collect the To test the adaptability of the FPR algorithm to different devices, we used a XIAOMI HM2 and an iPhone 4S (IOS 6.1.3, Apple, Cupertino, CA, USA) to repeat the experiments. There was little change in the positioning error, which means the FPR algorithm has good adaptability to different smartphones, as can be seen in Figure 13. To test the adaptability of the FPR algorithm to different devices, we used a XIAOMI HM2 and an iPhone 4S (IOS 6.1.3, Apple, Cupertino, CA, USA) to repeat the experiments. There was little change in the positioning error, which means the FPR algorithm has good adaptability to different smartphones, as can be seen in Figure 13. From the above experimental results, we can see that the FPR algorithm can offer better positioning accuracy over a certain range of speeds and has good adaptability to different devices, but it also has two drawbacks: one is that its positioning accuracy is limited by the RP interval, the other is the accumulating positioning error when direction-hopping is happening.
In the HMM method testing, the red line and the yellow line are treated as the model training trajectories, and the walking path is the green line as shown in Figure 8. We use the FPR algorithm to estimate the transition probability with the measurements collected at the speed of 2 m/s from two directions, one time from east to west, and the other time from west to east. To collect the From the above experimental results, we can see that the FPR algorithm can offer better positioning accuracy over a certain range of speeds and has good adaptability to different devices, but it also has two drawbacks: one is that its positioning accuracy is limited by the RP interval, the other is the accumulating positioning error when direction-hopping is happening.
In the HMM method testing, the red line and the yellow line are treated as the model training trajectories, and the walking path is the green line as shown in Figure 8. We use the FPR algorithm to estimate the transition probability with the measurements collected at the speed of 2 m/s from two directions, one time from east to west, and the other time from west to east. To collect the measurements for HMM method testing, a user walks at a variable speed which is no more than 2 m/s with the Samsung S5 (Samsung, Tianjin, China) following the green line from the door of the room marked as 404 to the west door of room 403. For comparison, we also use the method mentioned by Liu et al. [10] to estimate the pedestrian position. The method HMM.acc combines the HMM with the accelerometer sensor to compute the pedestrian position. The HMM.noacc is an alternative solution if the accelerometer sensor is unavailable, which needs to assume the pedestrian walks at a uniform speed.
The estimation of the user position along the green path is shown in Figure 14. Because of the characteristics of the FPR algorithm, all the estimated positions are on the RPs, thus reducing the positioning accuracy to a certain extent but within the range of acceptability. Also, from Figure 14 we can learn that, because of the incomplete coverage of the planned path, the estimated position has been hopped in the lower-middle area of the corridor. The HMM.acc has the best positioning accuracy, as the estimated positions with HMM.acc are closer to the walked path in Figure 14b. It seems like the HMM.noacc has the worst positioning accuracy since some estimated positions cluster together in Figure 14c. The results are further compared in Figure 15.
Sensors 2016, 16,1447 15 of 20 measurements for HMM method testing, a user walks at a variable speed which is no more than 2 m/s with the Samsung S5 (Samsung, Tianjin, China) following the green line from the door of the room marked as 404 to the west door of room 403. For comparison, we also use the method mentioned by Liu et al. [10] to estimate the pedestrian position. The method HMM.acc combines the HMM with the accelerometer sensor to compute the pedestrian position. The HMM.noacc is an alternative solution if the accelerometer sensor is unavailable, which needs to assume the pedestrian walks at a uniform speed. The estimation of the user position along the green path is shown in Figure 14. Because of the characteristics of the FPR algorithm, all the estimated positions are on the RPs, thus reducing the positioning accuracy to a certain extent but within the range of acceptability. Also, from Figure 14 we can learn that, because of the incomplete coverage of the planned path, the estimated position has been hopped in the lower-middle area of the corridor. The HMM.acc has the best positioning accuracy, as the estimated positions with HMM.acc are closer to the walked path in Figure 14b. It seems like the HMM.noacc has the worst positioning accuracy since some estimated positions cluster together in Figure 14c. The results are further compared in Figure 15. It can be seen in Figure 15 that the HMM.FPR (Fuzzy Pattern Recognition) indeed has better positioning accuracy than HMM.noacc, but slightly worse than HMM.acc. The HMM.acc utilizes an accelerometer sensor to provide the pedestrian dynamics information, which is useful to improve It can be seen in Figure 15 that the HMM.FPR (Fuzzy Pattern Recognition) indeed has better positioning accuracy than HMM.noacc, but slightly worse than HMM.acc. The HMM.acc utilizes an accelerometer sensor to provide the pedestrian dynamics information, which is useful to improve the positioning accuracy. The HMM.noacc offers the worst positioning accuracy because the pedestrian walks at variable speeds, and the assumption of uniform speed will compromise the positioning accuracy. HMM.FPR uses the estimated transition probability to mitigate the effect of direction-hopping, which will effectively reduce the maximum positioning error.
Sensors 2016, 16,1447 16 of 20 the positioning accuracy. The HMM.noacc offers the worst positioning accuracy because the pedestrian walks at variable speeds, and the assumption of uniform speed will compromise the positioning accuracy. HMM.FPR uses the estimated transition probability to mitigate the effect of direction-hopping, which will effectively reduce the maximum positioning error.

Performance Evaluation in a Library Building
After testing the method in the office area, we chose a relatively open indoor area to further evaluate our method. The open area is on the first floor of our university library (Beijing, China), which has dimensions of 60 m × 40 m. There are a total of 19 APs covering this area, all of which are RG-AP220-E APs deployed in the ceiling. Because there are not so many barriers, some APs can reach this area even at a great distance. The rough position of the APs is given in Figure 16. The whole area has been divided into 600 uniform 2 m × 2 m grids, and the RP interval is 2 m.

Performance Evaluation in a Library Building
After testing the method in the office area, we chose a relatively open indoor area to further evaluate our method. The open area is on the first floor of our university library (Beijing, China), which has dimensions of 60 m × 40 m. There are a total of 19 APs covering this area, all of which are RG-AP220-E APs deployed in the ceiling. Because there are not so many barriers, some APs can reach this area even at a great distance. The rough position of the APs is given in Figure 16. The whole area has been divided into 600 uniform 2 m × 2 m grids, and the RP interval is 2 m.

Performance Evaluation in a Library Building
After testing the method in the office area, we chose a relatively open indoor area to further evaluate our method. The open area is on the first floor of our university library (Beijing, China), which has dimensions of 60 m × 40 m. There are a total of 19 APs covering this area, all of which are RG-AP220-E APs deployed in the ceiling. Because there are not so many barriers, some APs can reach this area even at a great distance. The rough position of the APs is given in Figure 16. The whole area has been divided into 600 uniform 2 m × 2 m grids, and the RP interval is 2 m.  As in Figure 8, we use three colors to present the planned path and the testing path. The red line and the yellow line are the planned path for training the transition probability. In this testing, we collect training samples from four directions to maximize precision. The green line is the only testing path that means all methods use the same measurements to estimate pedestrian position. The starting point is marked as a green dot and arrows are used to mark the walking direction. The 100 test measurements are collected by a user walking along the green path at a variable speed of less than 2 m/s when the library is open.
The positions in the open area estimated by different methods are shown in Figure 17. The KNN and the PL algorithm have the worst positioning accuracy because of the numerous ambiguous results shown in Figure 17a,b. The FPR algorithm is much better than the KNN and PL algorithm but also has some estimated positions with a large distance to the test path. The errors caused by direction-hopping are greater in an open area. The HMM.FPR performs better than HMM.noacc but worse than HMM.acc, and there are few large distance errors in Figure 17d, indicating that the HMM plays an important role in mitigating the effect of direction-hopping. The HMM.acc also has the best positioning accuracy, and the open area seems to have no influence on HMM.acc and HMM.noacc. The RMSE and the CDF of the different methods are shown in Figure 18. As in Figure 8, we use three colors to present the planned path and the testing path. The red line and the yellow line are the planned path for training the transition probability. In this testing, we collect training samples from four directions to maximize precision. The green line is the only testing path that means all methods use the same measurements to estimate pedestrian position. The starting point is marked as a green dot and arrows are used to mark the walking direction. The 100 test measurements are collected by a user walking along the green path at a variable speed of less than 2 m/s when the library is open.
The positions in the open area estimated by different methods are shown in Figure 17. The KNN and the PL algorithm have the worst positioning accuracy because of the numerous ambiguous results shown in Figure 17a,b. The FPR algorithm is much better than the KNN and PL algorithm but also has some estimated positions with a large distance to the test path. The errors caused by direction-hopping are greater in an open area. The HMM.FPR performs better than HMM.noacc but worse than HMM.acc, and there are few large distance errors in Figure 17d, indicating that the HMM plays an important role in mitigating the effect of direction-hopping. The HMM.acc also has the best positioning accuracy, and the open area seems to have no influence on HMM.acc and HMM.noacc. The RMSE and the CDF of the different methods are shown in Figure 18.   It is more obvious in Figure 18a that the FPR algorithm performs better than the KNN and PL algorithms. To compare the influence of the different scenarios, we give the RMSE (Root Mean Square Error) and the CDF (Cumulative Distribution Function) of the FPR algorithm in the office scenario in Figure 18a,b. Although the FPR algorithm shows a slight performance degradation in the open area, the RMSE of this algorithm is still less than 4 m, and more than 70% of the positioning errors are no more than 4 m as shown in Figure 18b. The influence of the different scenarios indicate that the FPR algorithm has better positioning accuracy in the space-constrained area.
In Figure 18c,d. we also give the error results of the HMM.FPR method in the office. Unlike the FPR algorithm, the HMM.FPR works well in both scenarios. The RMSE of the HMM.FPR is about 2 m and the accuracy of the HMM.FPR within 3 m is about 75%, which is acceptable for pedestrians in an indoor area. Also, this method mitigates the effect of the direction-hopping of the KNN algorithm in the open area. As expected, the HMM.FPR has better positioning accuracy than HMM.noacc, but one that is worse than HMM.acc. The experimental results show that the proposed HMM.FPR method can obtain satisfactory accuracy in pedestrian dynamic positioning without using other sensors.

Conclusions
In this paper. A method for precise pedestrian positioning in an indoor environment using a trained HMM with a fuzzy pattern recognition algorithm was proposed. The presented fuzzy pattern recognition algorithm can offer better positioning accuracy during pedestrian walking because this algorithm utilizes the RSSI variation trend of the different locations to replace the specific RSSI values, which display significant deviations during dynamic measurement. To improve the positioning accuracy and mitigate the effect of direction-hopping, we introduce the trained HMM with the FPR algorithm in the WLAN fingerprint system. We use a rebuilt radio map and training trajectories to train the HMM with the FPR algorithm; thus, the most likely position of the pedestrian can be estimated by employing the Viterbi algorithm in the HMM. In our experiments, we demonstrate that the fuzzy pattern recognition algorithm has acceptable positioning accuracy and good environmental adaptability, and the accuracy is better after we embedded the fuzzy pattern recognition algorithm into the trained HMM. Future studies will focus on optimizing features of the proposed method, such as the AP selection, planned path selection and multi-sensor fusion.