In Recommender Systems design we are faced with the following problem: given incomplete information about users preference, content information, user-items rating and contextual information, learn the user preference and suggest new items for users based on features as:
- previous pattern of items preference of the user;
- preference of users with similar rating pattern;
- contextual information: location, time (of the day, week, month, year), social network.
This is usually formulated as a matrix completion problem using Matrix Factorization techniques to offer a optimal solution. Is this case latent features for users and item are inferred from the observed/rated items for each user, and from this latent features the missing entries are estimated. One major modelling tool for this problem is probabilistic modelling, and there are many proposals in the literature of different Probabillistic Matrix Factorization approaches. We will briefly discuss some of this models, starting with the seminal paper: Probabilistic Matrix Factorization (PMF) – [Salakhutdinov and Mnih, 2008, NIPS].
In this model for collaborative filtering, each item of the user-item rating matrix is a result of a linear combination of items and users latent attributes perturbed by a Gaussian white noise. The latent features are modeled as random vectors generated by a zero-mean isotropic multivariate Gaussian. We will use this model and try to show one of its key properties: calculating its MAP (mode of the posterior) estimator is equivalent to minimizing the Frobenius norm (sum of square roots) of the error matrix (difference between estimated and real values), plus L1 terms of the latent matrices.
Keeping the notation of the figure, we have N user and M items. Each user i and each item j is represented in a latent space as a D-dimensional vector and . (note that is the identity matrix with elements). The generative model with three parameters is:
- for generate i.i.d. samples
- for ,
- for generate i.i.d. samples
- for ,
- for and generate i.i.d. samples (a variation would be , where the function is applied to bound the mean in the same scale of the observed rating/values)
With the full description of the model we can calculate the probability of generating a specific matrix , with latent features, given the parameters of the model.
Given that some elements of the ratings matrix are not observed we will use an auxiliary variable equaling to 1 whenever the value is observed and 0 otherwise. Now the model probability conditioned on the parameters and latent features can be written as
The posterior of the U an V latent features can be expressed as
Taking the log we have
Since the log does not affect the computation of the mode of the posterior, maximizing the log posterior is equivalent to maximizing the posterior. Since we are maximizing with respect to the matrices U and V, the term does not affect the optimization and should be ignored. So,
Now we will describe the term in the and show how this optimization can be done using gradient descent.
Ignoring the constants but keeping the parameters, and knowing that the log of multiplication is the sum of log
So finding U,V that maximizes the posterior distribution of U,V given the data and parameters is equivalent to finding U,v minimizing Equation 1 (which can be simplified to Equation 2).
The Gradient Descent algorithm consists of updates in the direction that minimizes until convergence.
With Gradient Descent each update costs rougly O(D(N+M)), which is not feasibly for large scale applications. In this case Stochastic Gradient Descent may be an alternative. The difference is that in GD we weight the the gradient at each observed value for each update, and SGD we evaluate the derivative at only one observed value for each update.