# Deep Matrix Factorization Approach for Collaborative Filtering Recommender Systems
## 2 Materials and Methods  
A current trend in the field of cf is to improve the quality of the predictions by means of different techniques of mf, such as PMF [29], NMF [30], and SVD++ [31]. However, all these techniques rely on the same approach: they pose an optimization problem through a loss function that measures the divergence of the model of the expected behavior of users and items in a collaborative context from the actual behavior. Trying to break with this paradigm, in this paper we present a novel recommendation model that, using the mf paradigm, introduces the principles of dl to refine the output of the model through successive trainings. We named this new model Deep Matrix Factorization (DeepMF). Figure 1 summarizes the operation of DeepMF. As we can observe, the model is initialized with the usual input of a cf-based rs: a matrix \(R\) that contains the ratings of the users to the items. Note that this matrix is sparse, since a user generally only votes a very small subset of the existing items. As in classical mf approaches, this matrix \(R\), that will be also called \(R=E^{0}\) in our context, is approximated by a dense matrix \(\hat{E}^{0}\) of the form \(\hat{E}^{0}=P^{0}\cdot Q^{0}\), where \(P^{0}\) and \(Q^{0}\) are matrices of small rank. This matrix \(\hat{E}^{0}\) provides the predicted ratings at the first step. At this point the dl begins. A new matrix \(E^{1}=R-\hat{E}^{0}\) is built by computing the attained errors between the original ratings \(R\) and the predicted ratings stored in \(\hat{E}^{0}\). This new matrix is, again, approximated by a factorization into two new small rank matrices \(\hat{E}^{1}=P^{1}\cdot Q^{1}\), which produces the errors at the second step \(E^{2}=E^{1}-\hat{E}^{1}\). This process is repeated as many times as desired, by generating and factorizing successive error matrices \(E^{1},\ldots,E^{N}\). Presumably, this sequence of error matrices converges to zero, so we get preciser predictions as we add new layers to the model. This method can be formalized as follows. Suppose that our CF-based RS is dealing with \(n\) users and \(m\) items, whose ratings are collected in a spare matrix \(R=(R_{u,t})\in\mathbb{R}^{n\times m}\), where \(R_{u,i}\) is the rating that the user \(u\) gave to item \(i\) (typically, integer values between 1 and 5), or \(R_{u,i}=\bullet\) if \(u\) has not rated the item \(i\). We look for a factorization of \(E^{0}=R\) of the form \(E^{0}\approx P^{0}\cdot Q^{0}\), where \(P^{0}\) is a \(n\times k^{0}\) matrix and \(Q^{0}\) is a \(k^{0}\times m\) matrix. Here, \(k^{0}\) is interpreted as the number of hidden factors we try to detect in the first step (typically \(k^{0}\) is around 10) and \(Q^{0}\), \(P^{0}\) are seen as the projection/co-projection of the \(n\) users and \(m\) items into a \(k^{0}\)-dimensional latent space. These small rank matrices are learned such that the product \(P^{0}\cdot Q^{0}\) is a good approximation of the ratings matrix \(E^{0}=R\), that is  
\[E^{0}\approx\hat{E}^{0}=P^{0}\cdot Q^{0} \tag{1}\]  
in the usual euclidean distance. By subtracting the approximation performed by \(\hat{E}^{0}\) to the original matrix \(R\) we can obtain a new sparse matrix \(E^{1}\) that contains the prediction error  
\[E^{1}=R-\hat{E}^{0}=E^{0}-P^{0}\cdot Q^{0}. \tag{2}\]  
Note that positive values in \(E^{1}\) denotes that the prediction is too low and must be increased and negative values in \(E_{1}\) denotes that the prediction is too high and must be decreased. As we stated before, the main contribution of the proposed method is its deep learning approach. This is achieved by performing a new factorization to the \(E^{1}\) error matrix in such a way that  
\[E^{1}\approx\hat{E}^{1}=P^{1}\cdot Q^{1}. \tag{3}\]  
The matrices \(P^{1},Q^{1}\) have orders \(n\times k^{1}\) and \(k^{1}\times m\) for a certain number of latent factors \(k^{1}\). Observe that we may take \(k^{1}\
eq k^{0}\) in order to get a different level of resolution in the factorization.