# Predicting Human Location Using Correlated Movements
## 6 The PCM-Based Location Prediction (PLP) Model
The vector \(v^{\text{max}}=\arg\max_{\mathbf{v}^{(i)}}P(\mathbf{t}=\mathbf{v}^{(i)}|c(z^{i_{2}}_{i_{1}}))\) that indicates the most likely location of the person is mapped onto symbolic position \(y^{\text{pred}}_{\text{NN}}\) by the inverse function, i.e., \(y^{\text{pred}}_{\text{NN}}=c^{-1}(v^{\text{max}})\). Now, the neural network training process that includes feed-forward propagation, a cost function calculation, and a parameter update is presented. First, feed-forward propagation is described. In this work, \(\mu\) is defined as the number of hidden layers, and a neural network is considered with logistic sigmoid activation units denoted by \(\sigma(.)\). Hereafter, the input layer is referred to as layer 0, the \(j^{\text{th}}\) hidden layer as layer \(j\) (\(1\leq j\leq\mu\)), and the output layer as layer \((\mu+1)\). Let \(\Theta=\{\mathbf{W}^{(1)},\mathbf{W}^{(2)},...,\mathbf{W}^{(\mu+1)},\mathbf{b}^{(1)},\mathbf{b}^{( 2)},...,\mathbf{b}^{(\mu+1)}\}\) denote all learning parameters consisting of weights and biases of the NN classifier. More specifically, \(\mathbf{W}^{(j)}\) and \(\mathbf{b}^{(j)}\) are the matrix of weights and the vector of biases, respectively, that indicate connections from layers \((j-1)\) to \(j\); \(\mathbf{h}^{(j)}\) is defined as the state vector at layer \(j\), and \(\mathbf{h}^{(j)}\) is given by:  
\[\mathbf{h}^{(j)}=\sigma\big{(}\mathbf{W}^{(j)\top}\mathbf{h}^{(j-1)}+\mathbf{b}^{(j)}\big{)}, \quad 1\leq j\leq\mu \tag{5}\]  
Note that \(\mathbf{h}^{(0)}\) is a vector of input features at layer 0. For the output layer, the unnormalized output vector \(\mathbf{h}^{(\mu+1)}\) is calculated by \(\mathbf{h}^{(\mu+1)}=\mathbf{W}^{(\mu+1)\top}\mathbf{h}^{(\mu)}+\mathbf{b}^{(\mu+1)}\). Then, the output of a softmax function represents the categorical distribution over locations where the \(i^{\text{th}}\) element of the output vector reflecting the probability that the person stays at time \(t\) in location \(i\) is calculated as follows:  
\[\hat{y}_{i}=P(\mathbf{t}=\mathbf{v}^{(i)}|c(z^{i_{2}}_{i_{1}}))=\frac{e^{h^{(\mu+1)}_{ i}}}{\sum_{j=1}^{|\mathbb{L}|}e^{h^{(\mu+1)}_{i}}} \tag{6}\]  
where \(h^{(\mu+1)}_{i}\) is the \(i^{\text{th}}\) value of unnormalized output vector \(\mathbf{h}^{(\mu+1)}\). Secondly, the calculation of the cost function is briefly described below. Assume that there are \(\eta\) training instances. Cost function \(J(\Theta)\) using the cross entropy metric and regularization method can be expressed as follows:  
\[J(\Theta)=-\frac{1}{\eta}\sum_{j=1}^{\eta}{\mathbf{t}^{(j)}}^{\top}\log\hat{y}^{( j)}_{\text{NN}}+\Omega(\mathbf{W}) \tag{7}\]  
where \(\hat{y}^{(j)}_{\text{NN}}\) and \(\mathbf{t}^{(j)}\) are, respectively, the estimated output and target vectors of the \(j^{\text{th}}\) instance, and \(\mathbf{W}\) denotes the weight matrices. Note that \(\log\hat{y}^{(j)}_{\text{NN}}\) is an element-wise operation. Regularization \(\Omega(\mathbf{W})\) is implemented using the \(L^{2}\) parameter norm penalty. Finally, parameters including weights and biases are obtained by applying a back propagation algorithm, which minimizes the cost value using the gradient descent method with momentum. Let \(\alpha\) and \(\gamma\) denote the learning rate of gradient descent and the momentum coefficient, respectively, (\(0\leq\gamma\leq 1\)). Let \(\tilde{\theta}\) denote a training parameter in the set \(\Theta\), i.e., \(\tilde{\theta}\in\Theta\). Then, each \(\tilde{\theta}\) is updated in the \(j^{\text{th}}\) epoch as follows:  
\[\omega=\gamma\omega+\frac{\partial J(\Theta)}{\partial\tilde{\theta}} \tag{8}\]  
\[\tilde{\theta}^{(j)}=\tilde{\theta}^{(j)}-\omega \tag{9}\]  
where partial derivative \(\frac{\partial J(\Theta)}{\partial\tilde{\theta}}\) is the gradient of the cost function with respect to \(\tilde{\theta}\), and \(\omega\) is the current velocity vector with the same dimensions as parameter \(\tilde{\theta}\).