# Social Recommendation Based on Quantified Trust and User's Primary Preference Space
## 5 Social Recommendation Model Based on User Primary Preference Space (UPPS)
### The UPVS Model  
In UPVS, we have a rating matrix \(R=\big{[}R_{ij}\big{]}_{N\times M}\), a trust matrix \(T=[T_{ik}]_{N\times N}\), a user primary preference feature matrix \(\hat{U}\in\mathbb{R}^{D\times N}\), an item feature matrix \(V\in\mathbb{R}^{D\times M}\) and three space projection matrixes \(M_{R}\), \(M_{B}\) and \(M_{W}\) that are mapping user primary preference features into rating space, truster space and trustee spaces, respectively. \(M_{R}\hat{U}_{i}\), \(M_{B}\hat{U}_{i}\) and \(M_{W}\hat{U}_{i}\) donate the user feature matrix of rating space, truster space and trustee space,  
Figure 5: The probabilistic graphical model of SoRec.  
respectively. Figure 6 is the overview of the UPPS model. According to probability theory, the conditional probability distribution of the rating matrix \(R\) is defined as:  
\[P(R|\hat{U},V,M_{R},\sigma^{2})=\prod_{i=1}^{N}\prod_{j=1}^{M}[N(R_{ij}\big{|}g(( M_{R}\hat{U}_{i})^{T}V_{j}),\sigma_{R}^{2})]^{I_{ij}^{R}}. \tag{10}\]  
where \(M_{R}\) is the space projection matrix that maps the primary preference space into the rating space. \(\hat{U}_{i}\) is the primary feature of user \(U_{i}\) and \(V_{j}\) is the feature vector of item \(v_{j}\). The prior of the user primary preference feature matrix \(U\) and the item feature matrix \(V\) are modeled as zero-mean spherical Gaussian distributions.  
The preference feature vectors of users in the rating scene and the social scene are regarded as the projections from preference features in the primary space by multiplying space projection matrixes, such as \(M_{R}\), \(M_{B}\) and \(M_{W}\). The primary vector of user \(i\) in the primary preference space is \(\hat{U}_{i}\). The preference vector in the rating space, the truster space and the trustee space are \(M_{R}\hat{U}_{i}\), \(M_{B}\hat{B}_{i}\) and \(M_{W}\hat{U}_{i}\), respectively. We model the rating data and trust data with matrix factorization. Then, we learn the user primary feature vectors and the space projection matrices. Finally, we use user primary feature vector \(\hat{U}_{i}\), the rating space projection matrix \(M_{R}\) and the item feature vector \(V_{j}\) to predict the missing rating by \(M_{R}\hat{U}_{i}V_{j}\).  
\[P(\hat{U}|\sigma_{U}^{2})=\prod_{i=1}^{N}N(\hat{U}_{i}|0,\sigma_{U}^{2}I) \tag{11}\] \[P(V|\sigma_{V}^{2})=\prod_{i=1}^{M}N(V_{j}|0,\sigma_{V}^{2}I).\]  
The prior of the space projection matrix \(M_{R}\) is:  
Figure 6: The overview of the UPPS model.  
\[P(M_{R}|\sigma_{M}^{2})=\prod_{i=1}^{N}N(M_{R_{i}}|0,\sigma_{M}^{2}I). \tag{12}\]  
The conditional probability distribution of the trust matrix \(T^{*}\) is defined as:  
\[P(T^{*}|\hat{U},M_{B},M_{W},\sigma^{2})=\prod_{i=1}^{N}\prod_{k=1}^{N}\left[N(T _{ik}^{*}|g((M_{B}\hat{U}_{i})^{T}(M_{W}\hat{U}_{k})),\sigma_{T}^{2})\right]^{T _{ik}^{T}}_{\hat{k}}. \tag{13}\]  
\(T_{ik}^{*}\) is the trust after quantification by our method TQ_RWR. The matrix \(M_{B}\), \(M_{W}\) and \(M_{R}\) have the same Gaussian distribution with the same mean and variance.  
According to a Bayesian inference, the posterior probability distribution of the matrix \(\hat{U},V,M_{U},M_{B}\) and \(M_{W}\) is:  
\[P(\hat{U},V,M_{R},M_{B},M_{W}|R,T^{*},\sigma_{U}^{2},\sigma_{V}^{2},\sigma_{M} ^{2})\propto P(R|\hat{U},V,M_{R},\sigma_{R}^{2})P(T^{*}|\hat{U},M_{B},M_{W}, \sigma_{T}^{2}) \tag{14}\]  
\(P(\hat{U}|\sigma_{U}^{2})P(M_{R}|\sigma_{M}^{2})P(V|\sigma_{V}^{2})P(M_{B}| \sigma_{M}^{2})P(M_{W}|\sigma_{M}^{2})\).  
Figure 7 shows the functional dependency between variables and parameters. The above has completed the modeling process of UPPS. Next, we need to optimize the parameters. Through learning the algorithm parameters, we can obtain the user's basic preference feature matrix \(\hat{U}\), item feature matrix \(V\) and spatial transfer matrix \(M_{R}\) that can be used for training data. Finally, we can calculate the user \(u_{i}\) prediction score \(\hat{R}_{ij}\) for the item \(v_{j}\) through \(M_{R}\hat{U}_{i}V_{j}\).