User:Milanambiar/sandbox

Matrix Completion is the task of filling in the missing entries of a partially observed matrix. Applications of matrix completion include the Netflix problem: Given a ratings matrix in which each entry $$(i,j)$$ represents the rating of movie $$j$$ by customer $$i$$ if customer $$i$$ has watched movie  $$j$$ and is otherwise missing, we would like to predict the remaining entries in order to make good recommendations to customers on what to watch next. Without any restrictions on the number of degrees of freedom in the completed matrix this problem is underdetermined since the hidden entries could be assigned arbitrary values. Thus matrix completion often seeks to find the lowest rank matrix or, if the rank of the completed matrix is known, a matrix of  rank $$r$$ that matches the known entries. In the case of the Netflix problem the ratings matrix is expected to be low- rank since user preferences can often be described by a few factors, such as the movie genre and time of release. Other applications include computer vision, where missing pixels in images need to be reconstructed, detecting the global positioning of sensors in a network from partial distance information, and multiclass learning.

The matrix completion problem is in general NP-hard, but there are tractable algorithms that achieve exact reconstruction with high probability.

Problem Statement
One of the variants of the matrix completion problem is to find the lowest rank matrix $$X$$ which matches the matrix $$M$$, which we wish to recover, for all entries in the set $$E$$ of observed entries. The mathematical formulation of this problem is as follows:

$$\begin{align} & \underset{X}{\text{min}} & \text{rank} (X) \\ & \text{subject to} & X_{ij} = M_{ij} & \;\; \forall i,j \in E\\ \end{align}$$

Candes and Recht proved that with assumptions on the sampling of the observed entries and sufficiently many sampled entries this problem has a unique solution with high probability.

An equivalent formulation, given that the matrix $$M$$ to be recovered is known to be of rank $$r$$, is to solve for $$X$$ where $$X_{ij} = M_{ij} \;\; \forall i,j \in E$$

Assumptions
A number of assumptions on the sampling of the observed entries and the number of sampled entries are frequently made to simplify the analysis and to ensure the problem is not underdetermined.

Uniform sampling of observed entries
To make the analysis tractable, it is often assumed that the set $$E$$ of observed entries and fixed cardinality is sampled uniformly at random from the collection of all subsets of entries of cardinality $$|E|$$. To further simplify the analysis, it is instead assumed that $$E$$ is constructed by Bernoulli sampling, i.e. that each entry is observed with probability $$ p $$. If $$p$$ is set to $$\frac{N}{mn}$$ where $$N$$ is the desired expected cardinality of $$E$$, and $$m,\;n$$ are the dimensions of the matrix (let $$m < n$$ without loss of generality), $$|E|$$ is within $$O(n \log n)$$ of $$N$$ with high probability, thus Bernoulli sampling is a good approximation for uniform sampling. Another simplification is to assume that entries are sampled independently and with replacement.

Lower bound on number of observed entries
Suppose the $$m$$ by $$n$$ matrix $$M$$ (with $$m < n$$) we are trying to recover has rank $$r$$. There is an information theoretic lower bound on how many entries must be observed before $$M$$ can be uniquely reconstructed. Firstly, the number of degrees of freedom of a matrix of rank $$r$$ is $$2nr - r^2$$. This can be shown by looking at the Singular Value Decomposition of the matrix and counting the degrees of freedom. Then at least $$2nr - r^2$$ entries must be observed for matrix completion to have a unique solution.

Secondly, there must be at least one observed entry per row and column of $$M$$. The Singular Value Decomposition of $$M$$ is given by $$U\Sigma V^T$$. If row $$i$$ is unobserved, it is easy to see the $$i^{\text{th}}$$ right singular vector of $$M$$, $$v_i$$, can be changed to some arbitrary value and still yield a matrix matching $$M$$ over the set of observed entries. Similarly, if column $$j$$ is unobserved, the $$j^{\text{th}}$$ left singular vector of $$M$$, $$u_i$$ can be arbitrary. If we assume Bernoulli sampling of the set of observed entries, the Coupon collector effect implies that entries on the order of $$O(n\log n)$$ must be observed to ensure that there is an observation from each row and column with high probability.

Combining the necessary conditions and assuming that $$r \ll m, n$$ (a valid assumption for many practical applications), the lower bound on the number of observed entries required to prevent the problem of matrix completion from being underdetermined is on the order of $$nr\log n $$.

Incoherence
The concept of incoherence arose in compressed sensing. It is introduced in the context of matrix completion to ensure the singular vectors of $$M$$ are not too "sparse" in the sense that all coordinates of each singular vector are of comparable magnitude instead of just a few coordinates having significantly larger magnitudes. The standard basis vectors are then undesirable as singular vectors, and the vector $$ \frac{1}{\sqrt{n}} \begin{bmatrix} 1 \\ 1 \\ \vdots \\ 1 \end{bmatrix} $$ in $$\mathbb{R}^n$$ is desirable. As an example of what could go wrong if the singular vectors are not sufficiently "sparse", consider the $$m$$ by $$n$$ matrix $$\begin{bmatrix} 1 & 0 & \cdots & 0 \\ \vdots & & \vdots \\ 0 & 0 & 0 & 0 \end{bmatrix}$$ with singular value decomposition $$I_m \begin{bmatrix} 1 & 0 & \cdots & 0 \\ \vdots & & \vdots \\ 0 & 0 & 0 & 0 \end{bmatrix} I_n$$. Almost all the entries of $$M$$ must be sampled before it can be reconstructed.

Candes and Recht define the coherence of a matrix $$U$$ with column space an $$r-$$dimensional subspace of $$\mathbb{R}^n$$ as $$\mu (U) = \frac{n}{r} \max_{i < n} \|P_U e_i\|^2 $$, where $$P_U$$ is the orthogonal projection onto $$ U $$. Incoherence then asserts that given the singular value decomposition $$U\Sigma V^T$$ of the $$m$$ by $$n$$ matrix $$M$$,


 * 1) $$\mu (U), \; \mu (V) \leq \mu_0 $$
 * 2) The entries of $$ \sum_k u_k v_k ^T $$ have magnitudes upper bounded by $$ \mu_1 \sqrt{\frac{r}{mn}} $$

for some $$\mu_0, \; \mu_1$$.

Convex Relaxation
The rank minimization problem is NP-hard. One approach, proposed by Candes and Recht, is to form a convex relaxation of the problem and minimize the nuclear  norm $$\|M\|_*$$ (which gives the sum of the  singular values of $$M$$ instead of $$\text{rank}(M)$$ (which counts the number of non zero  singular values of $$M$$) . This is analogous to minimizing the L1- norm rather than the L0- norm for vectors.  The  convex relaxation can be solved using semidefinite programming (SDP) by noticing that the optimization problem is equivalent to

$$\begin{align} & \underset{W_1, W_2}{\text{min}} & & \text{trace} (W_1) + \text{trace} (W_2) \\ & \text{subject to} & & X_{ij} = M_{ij} \;\; \forall i,j \in E\\ & & & \begin{bmatrix} W_1 & X \\ X^T & W_2 \end{bmatrix} \succeq 0 \end{align}$$

The complexity of using SDP to solve the convex relaxation is $$O(\text{max}(m,n)^4)$$. State of the art solvers like SDP3 can only handle matrices of size up to 100 by 100 An alternative first order method that approximately solves the convex relaxation is the Singular Value Thresholding Algorithm introduced by Cai, Candes and Shen.

Candes and Recht show, using the study of random variables on Banach spaces, that if the number of observed entries is on the order of $$\max{\{\mu_1^2, \sqrt{\mu_0}\mu_1, \mu_0 n^{0.25}\}}nr \log n $$ (assume without loss of generality $$m < n$$), the rank minimization problem has a unique solution which also happens to be the solution of its convex relaxation with probability $$1-\frac{c}{n^3}$$ for some constant $$c$$. If the rank of $$M$$ is small ($$ r \leq \frac{n^{0.2}}{\mu_0}$$), the size of the set of observations reduces to the order of $$\mu_0 n^{1.2} r \log n$$. These results are near optimal, since the minimum number of entries that must be observed for the matrix completion problem to not be underdetermined is on the order of $$nr \log n$$.

This result has been improved by Candes and Tao. They achieve bounds that differ from the optimal bounds only by polylogarithmic factors by strengthening the assumptions. Instead of the incoherence property, they assume the strong incoherence property with parameter $$\mu_3$$. This property states that:


 * $$| \langle e_a, P_U e_{a'} \rangle - \frac{r}{m} 1_{a = a'} | \leq \mu_3 \frac{\sqrt{r}}{m} $$ for $$a, a' \leq m$$ and $$| \langle e_b, P_U e_{b'} \rangle - \frac{r}{n} 1_{b = b'} | \leq \mu_3 \frac{\sqrt{r}}{n}  $$ for $$b, b' \leq n $$
 * 1) The entries of $$\sum_i u_i v_i^T $$ are bounded in magnitude by $$\mu_3 \sqrt{\frac{r}{mn}}$$

Intuitively, strong incoherence of a matrix $$U$$ asserts that the orthogonal projections of standard basis vectors to $$U$$ has magnitudes that have high likelihood if the singular vectors were distributed randomly.

Candes and Tao find that when $$r$$ is $$O(1)$$ and the number of observed entries is on the order of $$\mu_3^4 n(\log n)^2$$, the rank minimization problem has a unique solution which also happens to be the solution of its convex relaxation with probability $$1-\frac{c}{n^3}$$ for some constant $$c$$. For arbitrary $$r$$, the number of observed entries sufficient for this assertion hold true is on the order of $$\mu_3^2 nr (\log n)^6$$

Gradient Descent
Keshavan, Montanari and Oh consider a variant of matrix completion where the rank of the $$m$$ by $$n$$ matrix $$M$$, which is to be recovered, is known to be $$r$$. They assume Bernoulli sampling of entries, constant aspect ratio $$\frac{m}{n}$$, bounded magnitude of entries of $$M$$ (let the upper bound be $$M_{\text{max}}$$), and constant condition number $$\frac{\sigma_1}{\sigma_r}$$ (where $$\sigma_1$$ and $$\sigma_r$$ are the largest and smallest singular values of $$M$$ respectively). Further, they assume the two incoherence conditions are satisfied with $$\mu_0$$ and $$\mu_1 \frac{\sigma_1}{\sigma_r}$$ where $$\mu_0$$ and $$\mu_1$$ are constants. They then propose the following algorithm:


 * 1) Let $$M^E$$ be a matrix that matches $$M$$ on the set $$E$$ of observed entries and is 0 elsewhere.  Trim $$M^E$$ by removing all observations from columns with degree larger than $$\frac{2|E|}{n}$$ by setting the entries in the columns to 0.  Similarly remove all observations from rows with degree larger than $$\frac{2|E|}{n}$$.
 * 2) Project $$M^E$$ onto its first $$r$$  principal components.  Call the resulting matrix $$\text{Tr}(M^E)$$.
 * 3) Solve $$ \min_{X,Y} \min_{S \in \mathbb{R}^{r \times r}} \frac{1}{2} \sum_{i,j \in E} (M_{ij} - (XSY^T)_{ij})^2 + \rho G(X,Y)$$ where $$G(X,Y)$$ is some  regularization function by gradient descent with line search.  Initialize $$X,\;Y$$ at $$X_0,\;Y_0$$ where $$\text{Tr}(M_E) = X_0 S_0 Y_0^T$$.  Set $$G(X,Y)$$ as some function forcing $$X, \; Y$$ to remain incoherent throughout gradient descent if $$X_0$$ and $$Y_0$$ are incoherent.  Return the matrix $$XSY^T$$.

Steps 1 and 2 of the algorithm yield a matrix $$\text{Tr}(M^E)$$ very close to the true matrix $$M$$ (as measured by the root mean square error (RMSE) with high probability.  In particular, with probability $$1-\frac{1}{n^3}$$, $$\frac{1}{mnM_{\text{max}}^2} \| M - \text{Tr}(M^E) \|_F^2 \leq C \frac{r}{m|E|} \sqrt{\frac{m}{n}} $$ for some constant $$C$$.  $$\| \cdot \|_F$$ denotes the Frobenius  norm.  Note that the full suite of assumptions is not needed for this result to hold.  The incoherence condition, for example, only comes into play in exact reconstruction.  Finally, although trimming may seem counter intuitive as it involves throwing out information, it ensures projecting $$M^E$$ onto its first $$r$$  principal components gives more information about the underlying matrix $$M$$ than about the observed entries.

In Step 3, the space of candidate matrices $$X,\;Y$$ can be reduced by noticing that the inner minimization problem has the same solution for $$(X,Y)$$ as for $$(XQ,YR)$$ where $$Q$$ and $$R$$ are orthonormal $$r$$ by $$r$$ matrices. Then gradient descent can be performed over the cross product of two Grassman manifolds. If $$r \ll m,\;n$$ and the observed entry set is in the order of $$nr\log n$$, the matrix returned by Step 3 is exactly $$M$$. Then the algorithm is order optimal, since we know that for the matrix completion problem to not be underdetermined the number of entries must be in the order of $$nr\log n$$.

Entries not sampled uniformly at random
The assumption that the set of observed entries of matrix $$M$$ is sampled uniformly at random is too strict for many real world applications. In the Netflix problem, for example, customers do not watch movies at random. The set of observed entries itself is skewed according to customer preferences. Singer and Cucuringu use rigidity theory to devise an algorithm determining whether a unique low-rank approximation to a partially observed matrix exists.

Noisy observation of entries
In another set up of the matrix completion problem, the observations of the true matrix $$M$$ are not only partial but noisy over the uniformly sampled set $$E$$. In particular, the observed matrix $$M^E$$ has entries $$M^E_{ij} = M_{ij} + \epsilon_{ij}$$ for $$(i,j) \in E$$ where $$\epsilon_{ij}$$ are the noises. Bayesian estimation is one technique that can be applied to this class of problems. It assumes the noise $$\epsilon_{ij}$$ is independently and identically distributed with mean 0 and is sub-Gaussian with known parameter $$\sigma_2$$, i.e. $$\log \mathrm{E} (\exp (t\epsilon_k)) \leq \frac{t^2 \sigma^2}{2} \forall t,k$$. For example, Gaussian noise with mean 0 and variance at most $$\sigma^2$$ satisfies these conditions.

To perform Bayesian estimation, a prior is put on the singular values of $$M$$ (the matrix we wish to recover) in the following sense: Parameters $$\gamma_1,\gamma_2,...,\gamma_r$$ are introduced, where $$M = UV^T$$, and it is assumed the $$i^\text{th}$$ column of $$U$$ and the $$i^\text{th}$$ row of $$V$$ follow a multivariate normal distribution with mean 0 and covariance matrix $$\gamma_i I$$ ($$I$$ is the identity matrix). A prior is placed on the $$\gamma$$s (conditional upon $$U$$ and $$V$$) and on the rank $$r$$ of $$M$$. If the priors on the $$\gamma_i$$s are chosen to be conjugate (e.g. the inverse-gamma distribution. Gibbs sampling or variational Bayesian methods can then be applied to calculate and iteratively update the posterior distribution