# Leveraging User Comments for Recommendation in E-Commerce
## 2 Collaborative Filtering  
Suppose there is a set of \(N\) users, \(u_{i}\), \(1\leq i\leq N\), and a set of \(M\) products, \(p_{j}\), \(1\leq j\leq M\). A user \(u_{i}\) may express his/her evaluation to a product \(p_{j}\) by providing a rating \(r_{ij}\), which is a positive integer, for \(p_{j}\). Usually, a higher rating is assumed to indicate a more favorable feedback from the user. If user \(u_{i}\) has not provided a rating for product \(p_{j}\), \(r_{ij}=0\). Such information can be represented by the following user-item rating matrix \(\mathbf{R}\):  
\[\mathbf{R}=\left[\begin{array}{cccc}r_{11}&r_{12}&\cdots&r_{1M}\\ r_{21}&r_{22}&\cdots&r_{2M}\\ \vdots&\vdots&\ddots&\vdots\\ r_{N1}&r_{N2}&\cdots&r_{NM}\end{array}\right] \tag{1}\]  
which is an \(N\times M\) matrix. Traditionally, collaborative filtering recommends products to each user solely based on such a user-item rating matrix. The idea is simple, but issues of data sparsity and scalability may arise.  
In [23], we proposed an approach to address the problem of scalability. Each product \(p_{i}\), \(1\leq i\leq M\), is represented as a \(N\)-vector, which is the \(i\)th column in \(\mathbf{R}\). A self-constructing clustering algorithm is applied to divide the products into a collection of \(g\) clusters \(C_{1},\ C_{2},\cdots,\ C_{g}\), with \(g\leq M\). Each cluster is regarded as one item group. Therefore, \(g\) item groups, denoted \(I_{1},\ I_{2},\cdots,\ I_{g}\), respectively, are obtained. Then a \(M\times g\) transformation matrix \(\mathbf{T}\) is formed, with the \((i,\ j)\)th entry \(t_{ij}\) denoting the membership degree of product \(p_{i}\) to item group \(I_{j}\), \(1\leq i\leq M\), \(1\leq j\leq g\).  
Next, the original user-item rating matrix \(\mathbf{R}\) is transformed to a reduced matrix \(\mathbf{B}\) by  
\[\mathbf{B}=\mathbf{RT} \tag{2}\]  
which is an \(N\times g\) matrix. Based on \(\mathbf{B}\), a \(g\times g\) correlation matrix is constructed. Then, ItemRank is applied, and a predicted preference list of item groups, \(\mathbf{h}_{i}\), is iteratively derived for each user \(u_{i}\). Sincerecommendation is done with **B**, which is of size \(N\times g\), rather than with **R**, which is of size \(N\times M\), efficiency is improved. Finally, the reverse transformation is performed:  
\[\textbf{s}_{i}=\textbf{Th}_{i} \tag{3}\]  
which is the predicted preference list of products for user \(u_{i}\), \(1\leq i\leq N\).  
However, collaborative filtering recommender systems may encounter difficulty due to sparsity. Consider Table 1, which is a small user-item rating matrix, consisting of 7 users and 7 items. Clearly, there are many missing ratings in **R**.  
Note that, because of sparsity, the rows of **R** are hardly similar to each other. Recommendations based on the similarity between the users will not be accurate at all. In addition, because of sparsity, the columns of **R** are hardly similar to each other. It is impossible to reduce the number of items by clustering techniques based on the similarity between the items. It is also impossible to reduce the number of users based on the similarity between the users. Therefore, data sparsity makes it hard in this case to get recommendations right and efficiently by collaborative filtering through similarity between the users or/and items.