# Social Recommendation Based on Quantified Trust and User's Primary Preference Space
## 5 Social Recommendation Model Based on User Primary Preference Space (UPPS)
### The Optimization of the UPPS Model  
Due to the conditional distribution of the rating matrix and the trust matrix and the prior distribution of the feature matrix being Gaussian distributions, we use the logrith  
Figure 7: Probabilistic graphical model of UPPS. of the posterior probability to conveniently calculate the gradient to maximum posterior probability. \[ \begin{array}{l}\ln P(\hat{U},V,M_{R},M_{B},M_{W}\big{|}R,T^{*},\sigma_{U}^{2}, \sigma_{V}^{2},\sigma_{W}^{2})\\ =-\frac{1}{2\sigma_{K}^{2}}\sum\limits_{i=1}^{N}\sum\limits_{j=1}^{M}I_{ij}^{R} [R_{ij}-g((M_{R}\hat{U}_{i})^{T}V_{j})]^{2}\\ \quad\quad\quad-\frac{1}{2\sigma_{T}^{2}}\sum\limits_{i=1}^{N}\sum\limits_{j= 1}^{N}I_{ij}^{T}[T_{ik}^{*}-g((M_{B}\hat{U}_{i})^{T}(M_{W}\hat{U}_{k}))]^{2}\\ \quad\quad\quad-\frac{1}{2\sigma_{T}^{2}}\sum\limits_{i=1}^{N}\hat{U}_{i}^{T} \hat{\Omega}_{i}-\frac{1}{2\sigma_{V}^{2}}\sum\limits_{j=1}^{M}V_{j}^{T}V_{j}- \frac{1}{2\sigma_{M}^{2}}\sum\limits_{i=1}^{D}M_{R_{i}}^{T}M_{R_{i}}\\ \quad\quad\quad-\frac{1}{2\sigma_{M}^{2}}\sum\limits_{i=1}^{D}M_{R_{i}}^{T}M_{ B_{i}}-\frac{1}{2\sigma_{M}^{2}}\sum\limits_{i=1}^{D}M_{W_{i}}^{T}M_{W_{i}}\\ \quad\quad\quad-\frac{1}{2}(\sum\limits_{i=1}^{N}\sum\limits_{j=1}^{N}I_{ij}^{ R}\ln\sigma_{R}^{2}+\sum\limits_{i=1}^{N}\sum\limits_{k=1}^{N}I_{ik}^{T}\ln\sigma_{T}^{2})\\ \quad\quad\quad-\frac{1}{2}(ND\ln\sigma_{U}^{2}+MD\ln\sigma_{V}^{2}+3D^{2}\ln \sigma_{M}^{2})+C.\end{array}  \tag{15}\]  
where \(C\) is a constant which does not depend on the parameters. Maximizing the above log-posterior with hyper-parameters is equal to minimizing the following objective function:  
\[ \begin{array}{l}L(\hat{U},V,M_{R},M_{B},M_{W},R,T^{*})\\ =\frac{1}{2}\sum\limits_{i=1}^{N}\sum\limits_{j=1}^{M}I_{ij}^{R}[R_{ij}-g((M_ {R}\hat{U}_{i})^{T}V_{j})]^{2}\\ \quad\quad\quad+\frac{\lambda_{T}}{2}\sum\limits_{i=1}^{N}\sum\limits_{k=1}^{ N}I_{ij}^{T}[T_{ik}^{*}-g((M_{B}\hat{U}_{i})^{T}(M_{W}\hat{U}_{k}))]^{2}\\ \quad\quad\quad+\frac{\lambda_{U}}{2}\|\hat{U}\|_{F}^{2}+\frac{\lambda_{V}}{2} \|V\|_{F}^{2}+\frac{\lambda_{U}}{2}\|M_{R}\|_{F}^{2}\\ \quad\quad\quad+\frac{\lambda_{M}}{2}\|M_{B}\|_{F}^{2}+\frac{\lambda_{M}}{2} \|M_{W}\|_{F}^{2}.\end{array}  \tag{16}\]  
where \(\lambda_{T}=\sigma_{R}^{2}/\sigma_{T}^{2}\), \(\lambda_{U}=\sigma_{R}^{2}/\sigma_{U}^{2}\), \(\lambda_{V}=\sigma_{R}^{2}/\sigma_{V}^{2}\), \(\lambda_{M}=\sigma_{R}^{2}/\sigma_{M}^{2}\). We use gradient descent approach to train the proposed UPPS model and to minimize corresponding objective functions. The gradients of the objective function \(L\) with respect to the parameters \(\hat{U},~{}V,~{}M_{R},~{}M_{B}\) and \(M_{W}\) are presented as follow, respectively. \[ \begin{array}{l}\frac{\partial L}{\partial\hat{U}_{i}}=\sum\limits_{j=1}^{M} I_{ij}^{R}g^{\prime}((M_{R}\hat{U}_{i})^{T}V_{j})[g((M_{R}\hat{U}_{i})^{T}V_{j})-R_{ ij}](M_{R}^{T}V_{j})\\ \quad\quad\quad+\lambda_{T}\sum\limits_{k=1}^{N}I_{ik}^{T}g^{\prime}((M_{B} \hat{U}_{i})^{T}(M_{W}\hat{U}_{k}))[g((M_{B}\hat{U}_{i})^{T}(M_{W}\hat{U}_{i})) -T_{ik}^{*}]\times(M_{B}^{T}M_{W}\hat{U}_{k})\\ \quad\quad\quad+\lambda_{T}\sum\limits_{k=1}^{N}I_{ni}^{T}g^{\prime}((M_{B} \hat{U}_{i})^{T}(M_{W}\hat{U}_{k}))[g((M_{B}\hat{U}_{i})^{T}(M_{W}\hat{U}_{i})) -T_{hi}^{*}]\times(M_{W}^{T}M_{B}\hat{U}_{h})+\lambda_{U}\hat{U}_{i}\end{array} \]  
\[