# Modeling Implicit Trust in Matrix Factorization-Based Collaborative Filtering
## 3 Model
### Trust Model
#### 3.3.2 Initial Trust Inference  
We define trust as the degree of a user's confidence toward the item preference they have expressed. It is common for users to rate items without having full confidence. For example, consider a case in which a user is asked to rate a popular movie and an average movie. The user liked both movies, but not equally. Nevertheless, the user provides a rating of 5 stars for both of the movies. In this case, it is highly likely for the user to have a higher confidence in the rating expressed for the popular movie than that for the average movie. Similarly, because of experience, a user who watches more movies would have a higher degree of confidence in their rating than a user who watches fewer movies. Conversely, this measure can be seen as the amount of user trust pertaining to a recommendation made by the recommendation system. This value is calculated as the product of the user's proportional rating and item popularity:  
\[\textit{prop\_rating}\ =\ \frac{|I_{u}|}{N_{u}} \tag{8}\]  
\[\textit{item\_popularity}\ =\ \frac{|U_{i}|}{N_{i}} \tag{9}\]  
\[t_{u,i}\ =\ \textit{prop\_rating}\times\textit{item\_popularity} \tag{10}\]  
where \(t_{u,i}\) is user \(u\)'s trust toward item \(i\)'s preference that he/she has expressed, \(|I_{u}|\) is the length of the user's preference vector, \(|U_{i}|\) is the item's preference vector, and \(N_{i}\) and \(N_{u}\) denote the total number of items and users in the set, respectively. The values for \(\textit{prop\_rating}\) for a specific user are the same for all the entries. Similarly, the values of \(\textit{item\_popularity}\) are the same for any specific item, as seen in lines 10-13 of Algorithm 1, which describes the initial trust calculation. Consequently, some computations are eliminated when calculating the trust. Another advantage of this trust measure is that it can also be applied to explicit preferences.  
```
1:procedureGenerateInitialTrust(\(RatingMatrix,\ \beta,w\))
2:\(n\_users\ =\textit{length}(RatingMatrix.rows)\), \(n\_items\ =\textit{length}(RatingMatrix.cols)\)
3:\(T=\textit{zeros}(n\_users,n\_items,)\)
4:\(R=\ \textit{generateBinaryMatrix}(RatingMatrix,\ \beta,w)\), //generating binary matrix
5:for\(u=0,u++,\ u<n\_users\)do
6:\(I_{u}\ =\ R(u,:)\),
7:\(\textit{Prop\_rating}\ \leftarrow\ \textit{length}(I_{u})/n\_users\)
8:\(\textit{Item\_popularity}\ =\ 0\)
9:for\(i=0,i++,\ i<n\_items\)do
10:if\(i\ ==\ 0\)then
11:\(U_{i}=\ R(:,i)\),
12:\(\textit{Item\_popularity}\ \leftarrow\ \textit{length}(U_{i})/n\_item\)
13:endif
14:\(T(u,i)=\textit{Prop\_rating}\times\ \textit{Item\_popularity}\)
15:endfor
16:endfor
17:return\(T\)
18:endprocedure
```  
**Algorithm 1** Pseudocode for initial trust calculation.  
The function _generateBinaryMatrix_ in line 4 of Algorithm 1 converts the preference matrix into a binary matrix by looping through the entries and comparing the values with \(\beta\). If the preference matrix consists of multiple dimensions, before the comparison, the matrix is flattened using Equations (5) and (6).  
Please note that unlike most trust models [4; 11], this trust measure considers the relationship between only the user and the user's expressed preference. However, the term \"trust\" in most of the trust models refers to a relationship either between a user and another user or between an item and another item. Therefore, the configuration of the resulting trust matrix has the same shape as that of the rating matrix.  
Since our objective is to improve the prediction accuracy by incorporating the trust values, we propose two approaches involving use of the estimated trust and use of the initial trust. The first approach involves estimation of the trust values before incorporating it into the predictions. In contrast, the second approach uses only the initially calculated trust values.