{'fraction_non_alphanumeric': 0.02963186481593241, 'fraction_numerical': 0.011104405552202776, 'mean_word_length': 4.93092340730136, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Multifloor Wi-Fi Localization System with Floor Identification

Indoor localization is of great importance in pervasive applications and RSS fingerprint is known as a quite effective indoor location method. Floor attenuation might not give enough margin discrepancy to classify two neighboring floors, such as windows nearby or ring structure. Fingerprint location using the nearest Euclidean distance to the reference point can be interfered by the neighboring floor. In this paper, a multifloor localization framework with floor identification is proposed. The discriminative floor model is trained to maximize between-class scatter and floor identification is triggered by stair walk and elevator events. In experiments, a real dataset is collected in the building of six floors to evaluate our method. The results show that our method can identify accurate location in multifloor environment.


Introduction
Indoor localization is of great importance in pervasive applications. Most localization methods based on Wi-Fi RSS have been proposed in the past decades [1][2][3][4][5]. Typical procedure of these methods is RSS fingerprints (e.g., Wi-Fi signal strengths from multiple access points) which have been recorded at preset locations and a reference fingerprint database is built. Localization algorithms retrieve the fingerprint database and return the best matched fingerprint as well as its corresponding location. Fingerprint-based indoor localization works well in signal floor environment. However, in multifloor environment, the building architecture is more complex and RSS fingerprint patterns of one floor will be interfered by the neighboring floors, for example, windows nearby or ring structure shown in Figure 9. Therefore, multifloor localization is still a great challenge.
In this paper, a novel and effective multifloor localization scheme is proposed. Our contributions are summarized as follows: firstly, the weakness of fingerprint location without floor identification in multifloor environment is stated and a discriminative floor model is proposed. Secondly, a framework of fingerprint-based location system with floor identification is designed. Floor identification is triggered by stair walk and elevator events. Finally, a real dataset is collected in the building of six floors to evaluate our method. The experiment results show that our method can identify accurate location in multifloor environment.

Related Work
Indoor localization researches in multifloor environment always fall into two categories: without floor identification [1,[6][7][8][9] and with floor identification [10][11][12][13]. Without floor identification methods assume that RSS fingerprints at each floor are quite different or unique and the closest distance to reference fingerprint in natural space can identify the location. Komar and Ersoy [1] used fingerprints and Euclidean distance to location in multifloor environment. Letchner et al. [6] proposed a hierarchical Bayesian network for large-scale wireless localization. The additional information of building graph model, known AP parameters, and motion tracking was required in sensor model learning. Wang et al. [7] coembedded different floors' data in some common low-dimensional manifold by labeled data on one floor, which assumed that the floor plans in a building are similar. Al-Ahmadi et al. [8] designed a Bayesian graphical model to estimate RSS strength in two-floor environment. There is also other work on how to track in a multifloor building, such as Woodman and Harle [9], who applied IMU sensors to track stair walking.  Figure 1: Multifloor localization framework.
In floor identification methods, which floor the pedestrian is on is always identified before accurate floor localization. Alsehly et al. [10] found the nearest reference WAP by -nearest neighbor algorithm to estimate the floor number. Varshavsky et al. [11] designed a GSM fingerprints localization system known as SkyLoc, to identify which floor a mobile phone user is on in multifloor buildings. GSM fingerprints were collected at each floor and floor classification is measured by Euclidean distance between testing fingerprint and training fingerprint. The fingerprint features selected for classification would improve classification accuracy. Liu and Yang [12] estimated floor number according to the average distance to the sampling fingerprints on one floor. Campos et al. [13] used backpropagation artificial neural networks with one competitive layer to identify the floor. However, backpropagation ANNs can suffer from local minima problem [14]. Besides, Ye et al. [15] used the accelerometer to identify the floor level. The stair walking style and velocity are uncertain factors for floor estimation. If a wrong floor level estimation occurs, then the later estimations are also always wrong.

Multifloor Localization Framework
Our multifloor localization framework has three main parts: (1) floor identification (blue block in Figure 1), (2) pedestrian state recognition (grey block in Figure 1), and (3) Wi-Fi fingerprint matching (red block in Figure 1). Wi-Fi fingerprint database consists of network identifier (SSID, Sever Set ID), the AP MAC (Medium Access Control) address, and RSS (Received Signal Strength) signal sampled from reference points in each floor. From this sampling database, discriminative floor model has been trained by FLD (Fisher's Linear Discriminant). Acceleration signals are periodically sampled from accelerometer and matched with some pedestrian patterns, such as walk, up-or downstairs, elevator, and stop. While stair walk or elevator pattern is found, the floor that the pedestrian is on might be changed and the floor number should be reestimated by discriminative floor model using runtime Wi-Fi fingerprint. Pedestrian is located by searching the most similar fingerprint among reference fingerprints at one floor using runtime Wi-Fi fingerprint. Detailed descriptions about these three parts in the framework are discussed in the following three sections.

Problems in Multifloor Buildings.
Without floor identification methods usually consider that fingerprints collected at the same floor are similar and will group together. However, due to the inherent complexity of radio-wave propagation in indoor environments, such assumption sometimes fails. In multifloor environment, the building architecture is more complex than single floor environment. The RSS from the same AP in two different rooms on the same floor may vary similar to the different floors. In other words, the RSS from neighboring floor can confuse the one from neighboring room in the RSS Euclidean space where most of the fingerprint-based localization methods search nearest neighboring fingerprints [1-3, 6, 7]. Figure 2 shows an example of multifloor environment and Figure 3 shows the RSS fingerprints records from locations A, B, C, D, E, and F from two Wi-Fi APs. Floor classification margin of E and F is not large enough to be separated from upper floor {A, B} and lower floor {C, D}.
There is another fact in multifloor environment. A concrete floor may reduce the RSS between 15 dB and 35 dB [16] and the floor attenuation factor (FAF) at locations near to the window frames is about 20 dB [8]. However, RSS values that are scanned by the same devices vary over time at a fixed location [17,18] since the radio signals are affected due to the environment. The variance of RSS values in this phenomenon can be 10 dB [17]. That is, the rise of RSS values can reduce floor attenuation and makes inference from adjacent floor greater.
International Journal of Distributed Sensor Networks

Discriminative Floor Model.
Let denote the RSS from AP . A Wi-Fi fingerprint can be defined as a vector where is the number of APs in a building. The reference fingerprints are collected during the training phase and stored in the Wi-Fi fingerprint database. Fisher's Linear Discriminant (FLD) [19] is a class specific method. It can not only reduce feature dimensionality, but also be made as classifiers in the reduced feature space.
FLD selects in [19] in such a way that the ratio of the between-class scatter and the within-class scatter is maximized. Let the between-class scatter matrix be defined as and let the within-class scatter matrix be defined as where is the mean of fingerprint vectors in th floor , is the number of reference points in th floor , and is the mean of . The optimal projection opt is chosen to maximize the ratio of the determinant of the between-class scatter matrix of the projected samples to the determinant of the within-class scatter matrix of the projected samples, The Since is of rank − 1 at most, so an upper bound on is − 1, where is the number of floors.
Then the new fingerprint vector by opt projection is where → rf is a runtime fingerprint for testing. The floor that the pedestrian stands on is classified by a majority vote of its neighbors, which is reference fingerprints in the database. This classification procedure is like NN ( -nearest neighbor) algorithm.
Fisher's Linear Discriminant finds a subspace to maximize the distance of two classes and minimize the distance within one class. Figure 4 shows the FLD space projection of Figure 3. The symbols on the solid line correspond to the symbols projected by the direction of dashed line in Figure 2. FLD achieves greater between-class scatter than original Euclidean space.

Pedestrian Patterns.
The rich sensors on smartphones, such as accelerometer, gyroscope, and compass, can measure acceleration, angular velocity, and absolute direction. The behavior of pedestrian can be estimated and considered as location context to help localization system [20,21]. A few errors in continuous floor identification will make the user ambiguous. Therefore, in our multifloor localization system, floor identification is only reestimated when floor change event may occur. Two pedestrian states may cause floor change event, one is up-or downstairs and another is in the elevator. Figure 5 shows the acceleration signal pattern when pedestrian is in the elevator. Figure 6 shows the acceleration signal pattern when pedestrian is walking on the stairs slowly, normally, and quickly. Typical pedestrian state transformation diagram is shown in Figure 7. While pedestrian state goes through Walk → Stair → Walk or Walk → Elevator → Walk, floor change event may occur.

Pedestrian Patterns Recognition.
Since speed of walk may vary, two temporal sequences are compared by DTW (Dynamic Time Warping) [22]. A well-known DTW application has been automatic speech recognition. DTW is able to eliminate the effect of different walking speed.
Given two acceleration signal profiles and with lengths of and samples, a warping path = ( 1 , . . . , ) defines an alignment between two sequences = ( 1 , . . . , ) and = ( 1 , . . . , ) by assigning the element of to the element of . The cost ( , ) of a warping path between and is defined as The optimal warping path between and is a warping path * having minimal total cost among all possible warping paths.
After DTW, pedestrian pattern similarity score is calculated as (8) Figure 8 shows DTW matching result between Figures 6(a) and 6(c) and similarity score is 0.997.

Fingerprint
Matching. In our system, location can be estimated by searching optimal reference location on a floor in the fingerprint database. To reduce the effect of heterogeneous devices and environment, the weight-RSS location algorithm in [17] is applied. The weight-RSS on location is defined as where ( ) is the index of after is sorted as descending order.
For tr from fingerprint map and te from a test device, their weighting factor tr,te is calculated as where is calculated as Then, the Euclidean distance Dist( tr , te ) between tr and te can be calculated as The optimal reference location is searching by -nearest neighbor algorithm on weight-RSS distance and the coordinates of the best match location are regarded as positioning result.

Fingerprint Database Collection.
The experiments are carried out on the building of six floors in Zhejiang University City College, as shown in Figure 9. The 1st floor and the 2nd to the 6th floor plans are shown in Figure 8. There are 160 grids for collecting the reference fingerprint in the 1st floor and 131 grids in the 2nd to the 6th floor. The distance between two adjacent grids is 1.6 meters. Four heterogeneous devices including 3 smartphones and 1 Tablet PC participated in this experiment, as shown in Table 1. The RSS fingerprints on one grid are collected 5 times and averaged to reduce the effect of random noise. To evaluate floor identification, 100 random locations on each floor are also sampled. The ground truth of these random locations is the nearest reference location.
International Journal of Distributed Sensor Networks

Floor Identification.
Floor discriminative model has been trained by the reference location fingerprints labeled with floor number in the database and random location sampling fingerprints are tested. Average distance [12], -nearest neighbor [10], and one-layer ANNs classifier [13] are also tested to be compared with FLD. Table 2 shows floor identification accuracy of our discriminative floor model and others. ANNs and our method, which are classifiers by training, are better than single distance measure without training. The results show that FLD archives 94.3% accuracy in floor identification.

Motion Recognition.
To evaluate the stair walking and elevator motion recognition, motion acceleration database has been built. The database has 10 individuals. Each person has four kinds of motions: upstairs, downstairs, elevator up, and elevator down. Each motion has been sampled twice. Stair walking has also been sampled in three different kinds of walking speed, for example, slow, normal, and fast. The position of smartphone is in hand, pants, and bag, respectively.  Totally 10 * 2 * 2 * 3 = 120 stair walking and 10 * 2 * 2 = 40 elevator motion acceleration samples are collected. Two individuals are considered as motion templates and the rest of the eight for testing. When the pattern similarity score is bigger than a threshold, motion template is matched. 10 * 2 * 3 = 60 normal walking samples in different walking speed have also been collected for recognition test. Figure 10 shows ROC (Receiver Operating Characteristic) curves of motion recognition. Since the acceleration signal pattern of upstairs and downstairs are quite similar and both of them can trigger floor change event, up-and downstairs are considered together as one stair walking motion. The results show that elevator motion recognition is better than stair walking. At about 20% false positive rate, 92% elevator motion and 82% stair walking can be discovered.

Localization
Results. The random location sampling fingerprints are tested to evaluate localization accuracy. The sampling position is located by the matching method discussed in Section 6 and the location error is the distance   between nearest fingerprint location in reference fingerprint database and the ground truth of sampling location. Table 3 shows the average location error and floor error percentage of fingerprint location with and without floor identification. The fingerprint matching algorithm has been discussed in Section 5.3. 19.6% floor errors happen in single fingerprintsbased location. After floor identification, about 13.9% floor location errors are corrected and the average location distance error has been reduced from 4.8 to 1.2 meters.

Conclusion
In this paper, a novel and effective multifloor localization scheme is proposed. The weakness of fingerprint location without floor identification in multifloor environment is stated. To maximize margin discrepancy between two neighboring floors in fingerprints space, a discriminative floor model is trained. Stair walking and elevator events recognition trigger the floor change event to reestimate floor number. To evaluate our method, experiments were done at a ring architecture building. About 800 reference fingerprint locations are collected in the building of six floors. The results show that our method can identify accurate location in multifloor environment. After floor identification, about 13.9% floor location errors are corrected and the average location distance error has been reduced from 4.8 to 1.2 meters.

Conflict of Interests
The authors declare that there is no conflict of interests regarding the publication of this paper.