# Diversity Balancing for Two-Stage Collaborative Filtering in Recommender Systems
## 3 Diversity Balancing for Two-Stage Collaborative Filtering
### Trust Ranking  
In the first stage of the proposed DBTS method, the user trust network \(G=\)\(<\)\(U\),\(T_{D}\)\(>\) is constructed according to user trust relationships. Each node \(u\in U\) of network G represents a neighbor of the active user \(v\). The \(T_{D}\) denotes the direct trust set of \(v\). Each edge \(T_{u,v}\in T_{D}\) represents the direct trust between users \(u\) and \(v\).  
However, methods that only consider direct trust often have limited effectiveness when the sparse data problem occurs. Implicit trust relationships that enrich the trust relationships of users can be obtained by further analyzing rating values. That is, although user \(u\) and \(v\) do not have a direct trust relationship, an implicit trust value is calculated by applying the Pearson correlation coefficient to the two users based on their available ratings. However, numerous implicit trust relationships are not required. According to the Three Degree of Influence Rule [43], a strong connection with user \(u\), i.e., a short connection distance to user \(u\) (less than 3 degrees) might lead to a similar behavior, while a weak connection with user \(u\), i.e., a long connection distance to user u (more than 3 degrees) only transmits information. Therefore, more users with no direct relation would be connected by expanding the implicit trust relations to their third-degree neighbors. As described in [37], the trust-based similarity values \(TS_{u,v}\) between user \(u\) and \(v\) can be calculated as:  
\[TS_{u,v}=\left\{\begin{array}{ll}\frac{2\times sim(u,v)\times T_{u,v}}{sim(u,v)+T_{u,v}}&sim(u,v)+T_{u,v}\
eq 0\text{ and }sim(u,v)\times T_{u,v}\
eq 0\\ T_{u,v}&sim(u,v)=0\text{ and }T_{u,v}\
eq 0\\ sim(u,v)&sim(u,v)\
eq 0\text{ and }T_{u,v}=0\end{array}\right. \tag{1}\]  
where \(T_{u,v}\) denotes the trust relation between user \(u\) and \(v\), which is calculated as:  
\[T_{u,v}=\frac{H-N_{u,v}+1}{H} \tag{2}\]  
where \(H\) denotes the maximum trust propagation distance among all users. The \(N_{u,v}\) denotes the trust propagation distance between users \(u\) and \(v\). Trust can propagate from one network node to  
Figure 1: Overview of the main stages of the proposed method.  
another via multiple paths. Here, the indirect trust value is set to the trust value for the shortest path. The \(sim(u,v)\) is the similarity value for users \(u\) and \(v\), which is computed as:  
\[sim(u,v)=\frac{\sum_{i\in I_{u,v}}{(R_{u,i}-\overline{R_{u}})(R_{v,i}-\overline {R_{v}})}}{\sqrt{\sum_{i\in I_{u,v}}{(R_{u,i}-\overline{R_{u}})}^{2}}\sqrt{ \sum_{i\in I_{u,v}}{(R_{v,i}-\overline{R_{v}})}^{2}}}\times\omega_{u} \tag{3}\]  
where \(R_{u,i}\) and \(R_{v,i}\) are the ratings of user \(u\) and user \(v\), respectively, for item \(i\) and where \(R_{u}\) and \(\overline{R}_{v}\) are the average ratings for user \(u\) and user \(v\), respectively. The \(I_{u,v}\) is the item set rated by both user \(u\) and user \(v\). Sometimes, users have few mutually rated items but high rating similarities. Therefore, mutual rating factor \(\omega_{u}=|I_{u,v}|/|I_{u}|\) is introduced to moderate the influences of mutual ratings in the similarity calculation. The \(|I_{u,v}|\) is the number of items rated by both user \(u\) and user \(v\). The \(|I_{u}|\) represents the number of items rated by user \(u\).  
Finally, according to the trust-based similarity values \(TS_{u,v}\), users can be divided into a high trust value set (\(TS_{u,v}\geq\theta\)) and a low trust value set (\(TS_{u,v}<\theta\)), where \(\theta\) is the predefined trust threshold.