Finally, we compute the correlation between the 20 imputed values and the actual values:
> cor(Xapp[ismiss], X[ismiss])
[1] 0.6535
In this lab, we implemented Algorithm 12.1 ourselves for didactic purposes.
However, a reader who wishes to apply matrix completion to their
data should use the softImpute
package on CRAN
, which provides a very
efficient implementation of a generalization of this algorithm.