{'fraction_non_alphanumeric': 0.03526227811828385, 'fraction_numerical': 0.0062087081111199555, 'mean_word_length': 4.827226345083488, 'pattern_counts': {'":': 0, '<': 2, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Supervised and Semi-supervised Deep Probabilistic Models for Indoor Positioning Problems

Predicting smartphone users location with WiFi fingerprints has been a popular research topic recently. In this work, we propose two novel deep learning-based models, the convolutional mixture density recurrent neural network and the VAE-based semi-supervised learning model. The convolutional mixture density recurrent neural network is designed for path prediction, in which the advantages of convolutional neural networks, recurrent neural networks and mixture density networks are combined. Further, since most of real-world datasets are not labeled, we devise the VAE-based model for the semi-supervised learning tasks. In order to test the proposed models, we conduct the validation experiments on the real-world datasets. The final results verify the effectiveness of our approaches and show the superiority over other existing methods.


INTRODUCTION
Location based services (LBS) are essential for applications like location-based advertising, outdoor/indoor navigation and social networking, etc. With the help of significant advancement of the smartphone technology in recent decades, smartphone devices are integrated with various built-in sensors, such as GPS modules, WiFi modules, cellular modules, etc. Acquiring the data from such kinds of sensors enables researchers to study human activities.
There are several types of data can be utilised for such research purpose. For instance, GPS equipment can provide relative accurate position information with latitudes an longitudes directly when the smartphone users stay outdoors, the GPS-based methods are favored by many researchers [1], [2]. However, this type of methods are not suitable for indoor positioning tasks because GPS coordinates are no longer available if the users stay indoors.
On such occasion, we have to utilize other indirect data to interpret the location information. Since WiFi connections Email: weizhu.qian@utbm.fr are widely used nowadays, one frequently used approach is to make use of the detected WiFi fingerprints of smartphone devices. In this case, the received signal strength indicator (RSSI) values of WiFi access points (WAPs) scanned by the mobile phones, instead of latitudes and longitudes, are used to compute the locations of the users. Compared to the GPS-based methods, the WiFi fingerprints-based localization method not only can function indoors but also are less energy-consuming.
In this work, we attempt to interpret WiFi fingerprints (RSSI values) into accurate users location (coordinates). However, this problem is not easy to solve. Typically, the RSSI vaule data are vectors whose elements represent the unique WAP IDs. To provide the good quality of WiFi connection, modern public buildings are equipped with a relatively large number of WiFi access points. As a result, this leads to the high dimensionality problem. Another issue is that the RSSI values are not always stable due to the signal-fading effect and the multi-path effect [3]. According to our investigation, we find that an ordinary deep-learning regressor with euclidean distance-based loss is not powerful enough to overcome such difficulties.
In order to solve these problems, we propose two deep learning-based models in this work. The first proposed model is called the convolutional mixture density recurrent neural network (CMDRNN). CMDRNN is designed to predict the user paths. In the CMDRNN model, to address the high dimensionlity issue, we deploy an one-dimensional convolutional neural network as a sub-structure to detect the feature of the input. In CMDRNN, in order to overcome the the instability problem of the data, a mixture density network substructure is incorporated into our model for calculating the final output. Meanwhile, since our task is a time-series prediction, we model the state transition via a recurrent neural network sub-structure. With such unique design, the CMDRNN model is able to predict user location with WiFi fingerprints.
As we know, labelling data usually is time-consuming and labor-consuming, thus most of real-word data in fact is unlabeled. However, even so, we still want to make as much use of accessible data as possible. For doing this, we proposed the second deep learning-based model, the VAE-based semisupervised learning model. In this approach, we assume that the input (RSSI values) and the target (user location) are governed by the same latent distribution. therefore, in the unsupervised learning process, we use the variation auto-encoder model to learn the latent distribution of the input whose information is relatively abundant. Then, in the supervised learning process, the labeled data is used to train the predictor. In this way, we can exploit more information of the dataset than other supervised learning methods.
The main contributions of our work are summarized as follows.
• We devise an novel hybrid deep-learning model (CM-DRNN) which allow us to predict the accurate position of the smartphone users based on detected WiFi fingerprints.
• We devised the VAE-based deep-learning models to perform semi-supervised learning for accurate indoor positioning.
• We conduct the evaluation experiments on the realworld datasets and compare our methods with other deep learning methods.
The reminder of the paper is organized as follows. Section 2 surveys the related work. Section 3 addresses the problem we will solve in this paper. In Section 4, the proposed method is introduced. Section 5 presents the validation experiments and the results with the real user data. Finally, we draw the conclusions and discuss about the potential future work in Section 6.

RELATED WORK
In literature, researchers have explored various types of machine learning techniques, both conventional machine learning and deep learning methods, on location recognition and prediction with WiFi fingerprints data.

Conventional machine learning methods
In the work of [4], the researchers compared many traditional machine learning methods, decision trees (DT), K-nearest neighbors (KNN), naive Bayes (NB), neural networks (NN), etc., for classifying buildings, floors and regions. In [5], the authors clustered the 3D coordinates data by K-means and clustered the RSSI data by the affinity clustering algorithm, respectively. Specially, in [6], the researchers compared 51 distance metrics to investigate the most suitable distance functions for accurate WiFi-based indoor localization. Some researchers used Gaussian processes (GPs) [7] to model the relationship between WiFi signal strengths and the indoor locations [8], [9], [10]. Whereas GPs are not scalable to large datasets due to the expensive computational cost.

Deep learning methods
Deep learning methods, such as convolutional neural networks (CNNs) [11], auto-encoders (AEs) [12] and recurrent neural networks (RNNs) also have been utilized in WiFibased positioning tasks. [13] used the CNN model for timeseries analysis. Generally, a buildings has many different WiFi access points, thus the RSSI data in many situations, can be very high dimensional. For this reason, it is reasonable to reduce the data dimension before carrying out a regression or a classification task. Some deep learning-based dimensionreduction methods like auto-encoders can be an appropriate choice [14], [15], [16]. For example, in the research of [15], the authors used an auto-encoder network to reduce the data dimension, then used a CNN to proceed accurate user positioning. In [14], [16], the researchers used auto-encoders to reduce the input dimension before using a multi-layer perceptron (MLP) to classify the buildings and floors.
For time series predictions, there are two typed of applicable deep architectures, CNNs and RNNs. In [3], the authors compared different types Recurrent Neural Networks including vanilla RNN, long short-term memory (LSTM), gated recurrent units (GRU) and bidirectional LSTM for accurate RSSI indoor localization. And they emplyed a weighted filter for both input and output to enhance the sequential modeling accuracy.

Limitation of convectional neural networks
Traditional neural networks (NNs) can be regarded as deterministic models, which can be described as follow.
where, x and y are the input and output of the NN, respectively. F represents the neural network structure and w is the wight of the NN.
Accordingly, the training loss (for instance, typically, mean squared errors) of NNs can be described as follow.
where, N is the total number of the input andŷ is the model target.
In many situations, a NN model is powerful enough to obtain satisfying results. However, in some cases, for instance, a high non-Gaussian inverse problem, the traditional neural networks will lead to very poor modeling results [17]. A good solution to this issue is to seek a framework that can calculate conditional probability distributions.
Mixture density networks (MDNs) solve this problem by using maximum likelihood estimation (MLE) [18]. In MDNs, the final output is sampled by a mixture distribution rather than computed directly. One advantage of MDNs is that it can be applied to an estimation situation in which a large variety lies. For instance, we can incorporate more mixture of Gaussians to a MDN to enhance its estimating capacity for more complex distributions. However, MLE also has obvious disadvantages. First, it needs to set some hyper-parameters properly (i.g., the mixture number of a MDN), otherwise, it may not provide the desirable result. Moreover, MLE can be biased when samples are small so MDNs are not suitable for semi-supervised learning. In practice, we also find that MDNs suffer from computational instability when the mixture number is large.
To alleviate the disadvantages of MDNs, the researchers introduced Bayesian neural networks (BNNs) [19], which applies Bayesian inference. BNNs follow the scheme of maximum a posterior (MAP) estimation, in which the prior knowledge of models and the likelihood are combined. MAP has the regularizing effect which can prevent overfitting. However, in practice, we find that BNNs are not flexible enough for very complex distribution like our case. We conjecture that this could be caused by the simple choice of the prior.
To solve this problem, we deploy a variational autoencoder [20], which is a deep latent generative model, in the proposed model to introduce a richer prior information. Meanwhile, since variational auto-encoders (VAEs) are unsupervised learning methods, we can use it to learn knowledge from the unlabeled data and to devise the semi-supervised learning model.

PROBLEM DESCRIPTION
In this work, our purpose is to interpret the smartphone user location with the corresponding WiFi fingerprints. In contrast to some previous work, we aim at obtaining the accurate user location, namely, the coordinates (either in meters or longitudes and latitudes) rather than treat this subject a classification task (identifying buildings and floors). The first task of our work is a time-series prediction task whose purpose is to predict the next time-point user location using current time-point WiFi fingerprints. The second task of our work is a smei-supervised learning location recognition task. We attempt to make use of not only the labeled data but also the unlabeled data to improve the location recognition accuracy.

PROPOSED METHODS
We will introduce two proposed deep-learning models. The first proposed model is called the cconvolutional mixture density recurrent neural network (CMDRNN), which is designed to prediction path with WiFi fingerprints. The second proposed model is a VAE-based model, which is designed to proceed semi-supervised learning for WiFi-based positioning.

1D convolutional neural network
In our first task, the input features are composed of the RSSI values of all the WiFi access points (WAPs) in the buildings, thus the input can be very high dimensional. In practice, we discover that the adjacent input features (Wifi access point values) are more likely to have the similar numerical values than the remote input feature. For this reason, to deal with the high dimensionality problem, we resort to the technique of convolutional neural network (CNN) [11]. CNN is a powerful tool for detecting feature and it is widely used for tasks like imagine processing, natural language processing and sensor signal processing. In particular, since the input of our model is the RSSI value vector, we adopt the 1D convoultional neural network to extract the proprieties of high dimensional input.

Recurrent neural network
Recurrent neural networks (RNNs) [21] are widely used for natural language process (NLP), computer vision and other time series prediction task.
The state transition of RNNs can be expressed as follow.
where, x t is the input, h t is the hidden state, σ h is the activation function, W h is the hidden weight for the input, U h is the hidden weight for the hidden state and b h is the hidden bias. The output of a conventional RNN can be expressed as follow.
where, y t is the output, σ y is the activation function, W y is the hidden weight for the input and b y is the output bias However, in practice, RNNs may suffer the long-term dependency problem during learning process. To address this problem, the researchers proposed long short-term memory networks (LSTMs) [22], which is a variant of RNNs. In our model, we employ the LSTM network to predict user location. More recently, the researchers proposed a variant of RNN, gated recurrent units (GRUs) [23], which have the similar accuracy as LSTMs but less computing cost. We will deploy these three RNN architectures into the proposed model as comparisons.

Mixture density network
A traditional neural network with a loss function, for instance, mean square errors, is optimized by a gradient-descent based method. Generally, such model can perform well on the problems that can be described by a deterministic function f (x), i.e., each input's corresponding output can only be one single specific value. However, for some stochastic problems, one input may be corespondent to more than one possible values. Generally, this kind of problems are better to be described as a conditional distribution p(y|x) than a deterministic function y = f (x). In such case, traditional neural networks may not work as expected.
To tackle with this kind of problems, intuitively, we can replace the original loss function with a conditional function, for a regression task, the Gaussian distribution can be the proper choice. Moreover, to utilize the mixed Gaussian distributions can improve the representation capacity of the model.
The researchers proposed the mixture density networks (MDNs) model [18]. In contrast with traditional neural network, the output of MDN is the parameters a set of mixed Gaussian distributions and the loss function become the conditional probabilities. Therefore, the optimization process is to minimize the negatived log probability. Hence, the loss function can be described as follow: where, x is the input, π k is the assignment probability for each model, with K k=1 π k = 1, (0 < π k < 1), and θ k is the internal parameters of the base distribution. For Gaussians, θ k = {µ k , σ k }, µ k is the means and σ k is the variances.
Accordingly, in the proposed model, the original output layer of the RNN, Eq. (4) ,is rewritten as this: where, θ t is the output of the RNN sub-model and also the input of the MDN sub-model, σ θ is the activation function, W θ is the hidden weight for the input and b θ is the output bias.
After the training process, we can use the neural network along with the mixed Gaussian distributions to illustrate the target distributions.

Proposed model
Combined with the merits of three aforementioned neural networks, we devised a novel deep neural network architecture, called the convolutional mixture density recurrent neural network (CMDRNN). In the CMDRNN model, an 1D CNN is used to capture the features of the high dimensional inputs, then the state transitions of the time series data is modeled by a LSTM-RNN model, and the output layer composed of mix Gaussian densities to enhance the pediction accuracy. With such an structure, we believe that our model is able to illustrate complicated high dimensional time series data.
update hidden states 7: θ ← σ y (W y * h t + b y ) compute network output 8: θ k ← θ assign mixture density parameters 9: minimize loss function: −p(y t |x t ; θ) 10: end while 11: end while 12: 13: Y ∼ p(y|x; θ) final output return Y sity estimation approach. Thus, the learning target of the proposed become a conditional distribution of the data rather than a common regressor. Thanks to this, our model can conquer such complicate modeling tasks.

VAE-based semi-supervised learning
We assume that x (RSSI values) and y (corrdiantes) are governed by the same latent variable z (building structures). However, in many real cases, the available datasets have more information about input x and less information about target y, thus it is more reasonable to infer the distribution of z via p(z|x) rather than via p(z|y). This procedure can be described as: where q(z) represents the prior distribution of z. Afterwards, if we apply the chain rule and assume the conditional generative scheme as follow.
Accordingly, the predicting model (either deterministic or probabilistic) can be described as: We can implement Eq. (7) and Eq. (9) by an unsupervised learning process an a supervised process, respectively. Therefore, our method consists of two steps:  • The second step (supervised learning): we employ a MLP model to obtain the target value y.
The structure of the VAE-based semi-supervised learning model is illustrated as Fig. 2

Unsupervised learning procedure
For the unsupervised learning process, we adopt a variational autoencoder as the generative model to learn the latent distribution. Variational autoencoders (VAEs) [20] are deep latent generative models.
In VAEs, the prior of the latent variable z yields to a standard Gaussian distribution.
In order to obtain the VAE encoder p(z|x; φ) via a MLP, z is reparameterized by the reparameterization trick: where, µ z is the mean of z and σ z is the variance of z.
The VAE decoder can be described as: x ∼ p(x|z; θ) (12) where x is the reconstructed input. The evidence lower bound (ELBO) of VAEs can be written as: Once L θ,φ (x) is maximized, we have the approximate posterior p(z|x; φ).

Deterministic predictor (M1 model)
After supervised training, we have the latent distribution z. For the supervised learning, to obtain the target y, we devise two predicting models, one is deterministic, the other is probabilistic.
As a nave approach, we can build a deterministic predictor which consists of two predicting steps: Step 1: to obtain the means of latent variables where, F µ (x; φ) can be regarded as the encoder of the VAE.
Step 2: to obtain the final prediction based on the output of Step 1.
where, F y (µ; w) is a deterministic multilayer perceptron model.
Consequently, the loss function is: Note that the direct input of this predictor is the latent variable z, which introduces the information of the distribution to the predictor. Hence, this predictor does not suffer the problem as conventional neural networks.

Probabilistic predictor (M2 model)
The proposed M2 model is more robust to the noise.
We apply the chain rule to obtain the factorized conditional distribution: logp(y|x; w) = logp(y|z; w) + logp(z|x; φ) Since Eq. (18) cannot be solved explicitly, we use Monte Carlo method to draw samples z, y. First, we draw the latent variables z from the VAE encoder: Then, we draw the predicted values y based on: Then, the loss function of the predictor can be written as: Since φ is already trained, here we only care about optimizing w. Thus, the loss function becomes: where, N is the mini batch size. Assume that the likelihood function p(y|z; w) is a Gaussian distribution with noise σ y .

Dataset Description
For the validation dataset, we select two WiFi RSSI-Coordinate paths from the Tampere dataset [24]. As shown in Fig. 3 The input dimension of the Tampere dataset is 489. The RSSI values of the detected WAPs range from −110 dB to 0 dB and the RSSI values of undetected WAPs are set to be 100.

CMDRNN architecture overview
The implementation details of our model are illustrated in Table 1. The CNN sub-network consists three layers, a convolutional layer, a max pooling layer and a flatten layer. The RNN sub-network includes a hidden layer with 200 neurons. The MDN sub-network has a hidden layer and output layer. The mixed Gaussians number of the MDN outputlayer is 30, and

Comparison with other methods
In order to prove the effectiveness of our method, we conduct a series of experiments to thoroughly compare our CMDRNN model to other deep learning approaches. The purposes of experiments are indicated as follows.
• Comparing optimizers: Adam v.s. RMSProp The overall results are demonstrated in Table 2.

Optimizers comparison
In [26], it reports that RMSProp [25] may have better performance on very non-stationary tasks than the Adam optimizer [27]. To verify that, we train our algorithm with RMSProp and Adam, respectively. As it is shown in Fig. 5, the proposed model can converge to a lower negative log-likelihood via RMSProp than Adam. Thus, we choose RMSProp as the optimizer for our model. Since the input is high dimensional, the sagacious way to deal with this is to incorporate a sub-network into the model for dimension reduction or feature detection. Many previous research adopted auto-encoders to reduce dimension, while we argue that the more appropriate choice for the task in our work is using an one-dimensional CNN. In order to prove that, we test three different models, one without a feature-detecting structure, one using using an auto-encoder and one using 1D CNN (the proposed model). The auto-encoder model with structure {hidden neurons: 256; hidden neurons: 128; code size: 64 ; hidden neurons: 128; hidden neurons: 256}.  The results in Fig. 6 and Table. 2 illustrate that the proposed model with 1D CNN feature detector can reach lower negative log-likelihood during the training process and has the smallest RMSE on the test data, respectively.

Dataset description
For the validation dataset, we use the UJIIndoorLoc dataset [28], which is similar to the Tampere dataset. The input dimension of the UJIIndoorLoc dataset is 520. The RSSI values of the detected WAPs range from −100 dB to 0 dB and the RSSI values of undetected WAPs are set to be 100. The coordinates are in longitudes and latitudes and we use the scaled values for the experiments. The total instances number for the experiments is about 20000.

Experimental results
Different from other supervised We make use of All the Fig.  9 demonstrates the distribution of latent variable z.
(b) Latent variables labeled with the floor IDs. tures, noted as MDN(5) and BNN, as comparisons.
From the results, we can see that the proposed models, M1 and M2, can provide satisfying results even when the labeled data is scarce. The predicting accuracy is improved when the labeled data increases. In contrast with other methods, the proposed models have better performance than other methods. Through the experiments, we also fin that the proposed models, compared to other methods, have such advantages:  • Compared to GPs, the proposed models are less computationally expensive.
• Compared to MDNs, the proposed models are more computationally stable.
• Compared to BNNs, the proposed models are more flexible to complex distributions.

CONCLUSIONS AND PERSPECTIVES
In this paper, we attempt to tackle the WiFi fingerprint-based user positioning problem. The first task is to predict the next user location with the current WiFi fingerprints. In contrast with existing approaches, our solution is to devise a hybrid deep learning model. The proposed model is composed of three deep neural network, a CNN, a RNN and a MDN. This unique deep architecture combines all the strengths of three deep learning models, which the enables us to recognize and predict user location with high accuracy. The second task is a semi-supervised learning problem for accurate user location recognition. To tackle this, we propose a VAE-based semi-supervised learning model. This model employs a VAE model to proceed unsupervised learning procedure. Meanwhile, in order to interpret WiFi RSSI values into coordinates, we devise two different predictors, one is a deterministic model, the other is a probabilistic model.
Finally, we test our models on the real-world datasets. For both of the tasks, the results verify the effectiveness of our approaches and show the superiority of our methods compared other deep learning based methods as well.
For the future work, we will explore other deep generative model for the potential applications for this research topic. For instance, normalising flows can be the potential approach to improve the performance.