# Event-Based Probabilistic Embedding for POI Recommendation
## 3 Model Inference and Learning
\begin{split}\frac{\partial\theta_{neural}}{\partial\theta_{t|r, z}^{t}}&=\frac{\partial\theta_{natural}}{\partial P_{rz}}\frac{ \partial P_{rz}}{\partial\theta_{t|r,z}^{t}}\\ &=\delta_{E,r}^{(r)}\theta_{v|r,z}^{(v)}\mathcal{I}_{v|r,z}\theta _{r|u}^{(r)}+\delta_{E,z}^{(z)}\theta_{v|r,z}^{(v)}\prod_{w_{i}\in W_{v}}\theta _{w|z}^{(w_{i})}\theta_{z|u}^{(z)}\end{split}  \tag{15}\]  
\[ \begin{split}\frac{\partial\theta_{neural}}{\partial\theta_{t|r, z}^{t}}&=\frac{\partial\theta_{natural}}{\partial P_{rz}} \frac{\partial P_{rz}}{\partial\theta_{v|r,z}^{t}}\\ &=\delta_{E,r}^{(r)}\theta_{t|r,z}^{(r)}\mathcal{I}_{v|r,z}\theta _{r|u}^{(r)}+\delta_{E,z}^{(z)}\theta_{t|r,z}^{(t)}\prod_{w_{i}\in W_{v}}\theta _{w|z}^{(w_{i})}\theta_{z|u}^{(z)}\end{split}  \tag{16}\]  
\[ \begin{split}\frac{\partial\theta_{neural}}{\partial\theta_{r|r}^ {t}}&=\frac{\partial\theta_{neural}}{\partial P_{rz}}\frac{ \partial P_{rz}}{\partial\theta_{r|u}^{r}}=\delta_{E,r}^{(r)}(\theta_{r|r}^{r} \cdot\theta_{v|r}^{(r)})P(l_{v}|r_{r},\Sigma_{r})\end{split}  \tag{17}\]  
\[ \begin{split}\frac{\partial\theta_{neural}}{\partial\theta_{z|u}^ {z}}&=\frac{\partial\theta_{natural}}{\partial P_{rz}}\frac{ \partial P_{rz}}{\partial\theta_{z|u}^{z}}=\delta_{E,z}^{(z)}(\theta_{t|z}^{( z)}\cdot\theta_{v|z}^{(z)})\prod_{w_{i}\in W_{v}}\theta_{w|w}^{(w_{i})}\\ \frac{\partial\theta_{neural}}{\partial\theta_{w|z}^{w}}& =\frac{\partial\theta_{neural}}{\partial P_{rz}}\frac{\partial P _{rz}}{\partial\theta_{w|z}^{w}}\\ &=\delta_{E,z}^{(z)}(\theta_{t|z}^{(z)}\cdot\theta_{(v|z)}^{(z)}) \theta_{z|u}^{z}\prod_{w_{i}\in W_{v}\delta w_{i}\
eq w}\theta_{w|z}^{(w)} \end{split}  \tag{19}\]  
where \(P_{rz}=[P_{r}^{(1)},P_{r}^{(2)},\dots,P_{r}^{(R)},P_{z}^{(1)},P_{z}^{(2)}, \dots,P_{z}^{(2)}]\), \(\delta_{E}\) is the residual of the embedded layer \(E\), \(\delta_{E,r}^{i}\), \(\delta_{E,z}^{i}\) represents that the residual of \(E_{r}^{i}\), \(E_{z}^{i}\). \(\delta_{E}\) can be calculated by neural network back-propagation. Due to space limitations, the derivation process of \(\delta_{E}\) is not listed. To update the parameters \(\theta_{PGM}\) for maximizing \(\mathcal{J}_{PGM}\), we use the gradient descent learning algorithm Projected Scaled Sub-Gradient (PSSG) [22], which is designed to solve optimization problems with L1 regularization on parameters. The gradients of model parameters \(\theta_{t|r,z}^{t}\), \(\theta_{v|r,z}^{v}\), \(\theta_{r|u}^{r}\), \(\theta_{z|u}^{r}\) and \(\theta_{w|z}^{w}\) are provided as follows. \[\frac{\partial\theta_{PGM}}{\partial\theta_{t|r,z}^{t}} = d(t,z,r)-\sum_{j=1}^{|D_{z}|}\theta_{z|u_{j}}^{(z)}\theta_{r|u_{j} }^{(r)}\theta_{t|r,z}^{t} \tag{20}\] \[\frac{\partial\theta_{PGM}}{\partial\theta_{v|r,z}^{v}} = d(v,z,r)-\sum_{j=1}^{|D_{z}|}\theta_{z|u_{j}}^{(z)}\theta_{r|u_{j} }^{(r)}\theta_{v|r,z}^{v}\] (21) \[\frac{\partial\theta_{PGM}}{\partial\theta_{r|u}^{r}} = d(u,r)-\theta_{r|u}*N_{u}\] (22) \[\frac{\partial\theta_{PGM}}{\partial\theta_{z|u}^{z}} = d(u,z)-\theta_{z|u}*N_{u} \tag{23}\]\[\frac{\partial\theta_{PGM}}{\partial\theta_{w|z}^{w}} = d(z,w)-d(z)\theta_{w|z}^{(w)} \tag{24}\]  
where \(d(t,z,r)\) is the number of activities assigned to topic \(z\) and region \(r\) on time \(t\); \(d(v,z,r)\) is the number of activities where the POI \(v\) is assigned to topic \(z\) and region \(r\); \(d(u,r)\), \(d(u,z)\) is the number of \(u\)'s activities which are assigned to topic \(r\) and region \(z\); \(d(z,w)\) is the number of activities where the word \(w\) is assigned to topic \(z\); \(d(z)\) is the number of activities which is assigned to topic \(z\); \(D_{t}\) denotes the set of activities occurring on time \(t\); \(D_{v}\) denotes the set of activities occurring at POI \(v\); and \(N_{u}\) is the number of \(u\)'s activities. For geographical modeling, the parameters \(\vec{\mu}\) and \(\vec{\Sigma}\) can be obtained in closed form as Equations (25) and (26).