# Weighted Matrix Factorization Recommendation Model Incorporating Social Trust
## 3 User-Based Collaborative Filtering and Trust-Based Social Networks
### Nonlinear Integration of Similarity and Trust Relationships  
By leveraging both user similarity-based collaborative filtering and trust-based social networks, two different types of predicted ratings can be obtained. Typically, the credibility and the amount of noise data contained in these two types of predicted ratings have different impacts on the final prediction outcome. Therefore, most models set a weight factor \(w\) to balance the influence of trust relationships and similarity relationships. While setting the weight factor \(w\) can determine the extent to which trust and similarity relationships influence the outcome to some degree, this impact is more reflected in the overall combination of the two types of predicted ratings, without giving sufficient attention to individual differences within the whole. Additionally, the original user-item rating matrix not only exhibits sparsity but the number of trust relationships between users is also relatively limited. Therefore, these two types of predicted ratings only fill part of the gaps in the rating matrix, and the overlap in their predictions is also relatively low. As illustrated in Figure 1's user-item rating matrix, to better integrate these two types of predicted ratings and enrich the user-item rating matrix while reducing its sparsity, this paper divides the predicted ratings into three parts:  
1. The first part consists of predicted ratings obtained solely from trust relationships. These ratings have no overlap with those obtained from similarity relationships and are represented in the matrix as \(t_{ui}\). 2. The second part includes predicted ratings derived solely from similarity relationships, distinct from those obtained from trust relationships. In the matrix, these ratings are denoted as \(s_{ui}\). 3. The third part is derived from the overlapping portion of the two types of predicted ratings, integrated together. This part is represented in the matrix as \(c_{ui}\). Figure 1: Representation of the three parts of the predicted ratings in the matrix. By setting an adaptive weight factor \(w_{ui}\) (ranging from 0 to 1), the overlapping parts of the two types of predicted ratings are dynamically integrated to obtain the value of \(c_{ui}\):  
\[c_{ui}=(1-w_{ui})\cdot t_{ui}+w_{ui}s_{ui} \tag{4}\]  
The value of \(w_{ui}\) is derived from user historical ratings. Before using Equation (2) to calculate the predicted ratings, this model sets two thresholds, \(\theta_{1}\) and \(\theta_{2}\), to filter the data. This approach enhances the reliability of user similarity, thereby reducing the impact of noise data on the predicted ratings, and subsequently determines \(w_{ui}\). The model sets the first quantity threshold, \(\theta_{1}\), for the number of items commonly rated by users. The similarity between users is calculated using Equation (1) if the number \(|l_{uv}|\) of items commonly rated by the users exceeds \(\theta_{1}\). Otherwise, the similarity is set to 0. The model sets a second similarity threshold, \(\theta_{2}\), for the calculated similarity. The predicted ratings for a user are calculated using Equation (2) if the user similarity \(sim(u,v)\) exceeds \(\theta_{2}\). This ensures that the user set \(N(u)\) in Equation (2) only includes users with a high degree of similarity to user \(u\), thereby further reducing the impact of noise data on the predicted ratings. After filtering through the two thresholds, when using Equation (2) to calculate the predicted rating of user \(u\) for item \(i\), the impact of noise data on the result becomes smaller. At the same time, the number of users in the set \(N(u)\) who have participated in rating item \(i\) by user \(u\) is obtained, denoted as \(m\). The weight factor \(w_{ui}\) can be calculated using the following piecewise function:  
\[w_{ui}=\left\{ \begin{array}{ll}\frac{m}{n},&1\leq m<n\\ 1,&m\geq n\end{array} \right. \tag{5}\]  
In this context, \(n\) is a configurable parameter.