## 3 Methodology
### Cpmf  
When dealing with sparse rating matrices, the features of users with fewer ratings tend to approach the prior mean, resulting in predicted ratings gravitating toward the average value. Therefore, in this study, CPMF is employed to handle sparse matrices and impose constraints on users with fewer ratings. This approach effectively enhances prediction accuracy and optimizes feature extraction outcomes. The model diagram of CPMF is illustrated in Figure 5.  
Where:  
\(M\) represents the interaction matrix generated between users and items. \(U\) signifies the matrix of implicit space features for users. \(V\) signifies the matrix of implicit space features for items. \(W\) is the user constraint matrix. \(I\) represents user rating information. \(Y\) signifies the user compensation matrix. Initially, the constraint matrix \(W\) enforces constraints on user features based on user rating information. This is followed by the combination, with the compensation matrix \(Y\) to derive the matrix of implicit space features for users, \(U\). Ultimately, the user's implicit space feature matrix \(U\), and the item's implicit space feature matrix \(V\), collaborate to generate the interaction matrix \(M\) between users and items. Figure 5: CPMF model. Given \(N\) users and \(G\) items, along with the interaction matrix \(M\)\(\sim\)\(N\)\(\times\)\(G\), with user and item implicit rating dimensions of \(D\), \(M=U^{T}V\) represents the inner product of users and items in the implicit space. The latent space feature vector for user \(i\) can be represented as:  
\[U_{i}=Y_{i}+\frac{\sum_{k=1}^{G}I_{ik}W_{k}}{\sum_{k=1}^{G}I_{ik}} \tag{10}\]  
where \(I_{ik}\) is the indicator function, taking the value 1 when user \(i\) has rated item \(k\), and 0 otherwise. Assuming the observation matrix \(M\) and the approximate rating matrix \(M^{\prime}\) follow Gaussian distributions with a mean of 0, the conditional distribution of the rating matrix is given by:  
\[p\big{(}M\big{|}Y,V,W,\sigma^{2}\big{)} \tag{11}\]  
Assuming that the latent feature vectors of an item, user compensation matrices, and user constraint matrix also follow Gaussian distributions with a mean of 0, we have:  
\[p(V\big{|}\sigma_{V}^{2})=\prod_{j=1}^{G}N(V_{j}\big{|}0,\sigma_{j}^{2}I) \tag{12}\]  
\[p(Y\big{|}\sigma_{Y}^{2})=\prod_{i=1}^{N}N(Y_{i}\big{|}0,\sigma_{i}^{2}I) \tag{13}\]  
\[p(W\big{|}\sigma_{W}^{2})=\prod_{k=1}^{G}N(W_{k}\big{|}0,\sigma_{k}^{2}I) \tag{14}\]  
Based on the objective function formula of Probabilistic Matrix Factorization [26], the loss function of CPMF can be derived as follows:  
\[ \begin{array}{l}J=\frac{1}{2}\sum_{i=1}^{N}\sum_{j=1}^{G}I_{ij}(M_{ij}-g([Y_ {i}+\frac{\sum_{k=1}^{G}I_{ik}W_{k}}{\sum_{k=1}^{G}I_{ik}}]^{T}V_{j}))^{2}\\ +\frac{\lambda_{Y}}{2}\sum_{i=1}^{N}||Y_{i}||_{Fro}^{2}+\frac{\lambda_{V}}{2} \sum_{j=1}^{G}||V_{j}||_{Fro}^{2}\\ +\frac{\lambda_{W}}{2}\sum_{k=1}^{G}||W_{k}||_{Fro}^{2}\end{array}  \tag{15}\]  
where \(g(x)=1/(1+e^{-x})\), \(\lambda_{Y}=\sigma^{2}/\sigma_{Y}^{2}\), \(\lambda_{V}=\sigma^{2}/\sigma_{V}^{2}\), \(\lambda_{W}=\sigma^{2}/\sigma_{W}^{2}\), _Fro_ representative \(||x||_{Fro}^{2}=X^{T}X\). Training is carried out using the stochastic gradient descent optimization algorithm [27] until convergence or reaching the maximum number of training iterations. The process is outlined as follows:  
First, compute the negative gradient of the loss function:  
\[ \begin{array}{l}\frac{\partial_{I}}{\partial Y_{i}}=-(M_{ij}-g_{ij})\sigma _{ij}^{\prime}V_{j}+\lambda_{Y}Y_{i}\\ =-e_{ij}g_{ij}^{\prime}V_{j}+\lambda_{Y}Y_{i}\end{array}  \tag{16}\]  
\[ \begin{array}{l}\frac{\partial_{I}}{\partial Y_{i}}=-(M_{ij}-g_{ij})\sigma_{ ij}^{\prime}U_{i}+\lambda_{Q}V_{j}\\ =-e_{ij}g_{ij}^{\prime}U_{i}+\lambda_{Q}V_{j}\end{array}  \tag{17}\]  
\[ \begin{array}{l}\frac{\partial_{I}}{\partial W_{k}}=-\frac{(M_{ij}-g_{ij})g_ {ij}^{\prime}}{\sum_{k=1}^{G}I_{ik}}V_{j}+\lambda_{W}W_{k}\\ =-\frac{e_{ij}g_{ij}}{\sum_{k=1}^{G}I_{ik}}V_{j}+\lambda_{W}W_{k}\end{array}