# Robust and Accurate Wi-Fi Fingerprint Location Recognition Method Based on Deep Neural Network
## 3 Theoretical Frameworks
### The Fine Localizer
#### 3.3.1 Constrained Kalman Filter Smoothing  
People usually move slowly in an indoor environment. We used KF to solve the smoothing problem in dynamic Wi-Fi location estimation to obtain the optimal estimation of a linear system. We took minimized mean square error as the criterion, estimated the current state by the previous optimal position, used the DNN-based Wi-Fi positioning results as the observation, then updated the information gain to obtain the optimal estimate of the current location. In this paper, the state vector consists of user positions, velocities and accelerations, and is represented as  
\[\mathbf{X}=[N,E,V_{N},V_{E},a_{N},a_{E}] \tag{10}\]  
In addition, the state estimation equation of the user at each time is expressed as:  
\[\mathbf{X}_{t+1,t}=\mathbf{A}_{t+1}\mathbf{X}_{t,t}+\mathbf{Q}\Rightarrow\left\{ \begin{array}[ ]{l}N_{t+1,t}=\hat{N}_{t,t}+\hat{V}_{t,t}^{N}\ast\Delta t+dw_{N}\\ E_{t+1,t}=\hat{E}_{t,t}+\hat{V}_{t,t}^{E}\ast\Delta t+dw_{E}\\ V_{t+1,t}^{N}=\hat{V}_{t,t}^{N}+\hat{a}_{t,t}^{N}\ast\Delta t+dw_{V}^{N}\\ A_{t+1,t}^{N}=\hat{a}_{t,t}^{N}+dw_{a}^{N}\\ A_{t+1,t}^{E}=\hat{a}_{t,t}^{E}+dw_{a}^{E}\end{array} \right. \tag{11}\]  
Figure 4: Process of the combination weighting method. where \(dw_{N}\), \(dw_{E}\), \(dw_{V}^{N}\), \(dw_{V}^{E}\), \(dw_{a}^{N}\) and \(dw_{a}^{E}\) denote the process noises, have a Gaussian distribution. The standard deviations matrix of the process noises is written as \(\mathbf{Q}=diag[\delta w_{N}{}^{2}\delta w_{E}{}^{2}\delta w_{V}^{N2}\delta w_{V}^{ E2}\delta w_{a}^{E2}]\), given \(\delta w_{N}\)= \(\delta w_{E}\)= 3, \(\delta w_{V}^{N}\)= \(\delta w_{V}^{E}\)= 0.5, \(\delta w_{a}^{N}=\delta w_{a}^{E}=\ 0.1\). The observation information consists of DNN-based Wi-Fi positioning results and the current user velocities. Therefore, the measurement equation of the system is:  
\[\mathbf{Z}_{t+1}=\left[ \begin{array}{c}N_{t+1}^{Wi-Fi}\\ F_{t+1}^{Wi-Fi}\\ V_{t+1}^{N}\\ V_{t+1}^{E}\end{array} \right]=\mathbf{H}\mathbf{X}_{t+1,t}+\mathbf{R} \tag{12}\]  
where \(\mathbf{H}=[diag[1\ 1\ 1\ 1]0_{4\times 2}]_{4\times 6}\), and \(\mathbf{R}=diag[\delta N^{2}\ \delta E^{2}\ \delta V_{N}^{2}\ \delta V_{E}^{2}]\) is measurement noise matrix, which has a Gaussian distribution, given \(\delta N=\delta E=12,\ \delta V_{N}=\delta V_{E}\)= 3. The real-time velocities \(V_{t+1}^{N}\) and \(V_{t+1}^{E}\) are calculated by the current Wi-Fi positioning results and the last optimal location. The calculation formula is as follows:  
\[\left\{ \begin{array}{c}V_{t+1}^{N}=(N_{t+1}^{Wi-Fi}-\hat{N}_{t,t})/\triangle t \\ V_{t+1}^{E}=(E_{t+1}^{Wi-Fi}-\hat{E}_{t,t})/\triangle t\end{array} \right. \tag{13}\]  
In the dynamic Wi-Fi positioning smoothing system, the Kalman filter is always adopted to update the state parameters by time and observation updates when Wi-Fi signals are available. In the prediction stage, we predict the state information and calculate its error covariance. The time-update method is expressed as:  
\[\ \We regard the movement of low-speed users in a short time period as a uniform motion, and the velocity information as a constraint condition. When the gross error occurs, the two adjacent positioning results with low-speed motion will be far away from each other, which leads to an abnormal increase in the real-time velocities. We calculate the average of the past three velocities and use that as the standard to judge whether the current velocities are abnormal.  
\[\tilde{|\mathbf{V}_{t}|}=\frac{1}{3}\sum_{i=t-3}^{t-1}|\mathbf{V}_{i}| \tag{21}\]  
When the real-time velocity is less than the standard \(|\mathbf{V}_{t}|\), it is considered that the observation information is normal, and the measurement noise remains unchanged. Otherwise, it is considered that the Wi-Fi positioning results in gross error and measurement noise need to be enlarged to make the final positioning result of the system closer to the state estimation and reduce the gross error interference.