April 2017
Intermediate to advanced
532 pages
12h 39m
English
We mentioned earlier that there is a close relationship between PCA and SVD. In fact, we can recover the same principal components, and also apply the same projection into the space of principal components using SVD.
In our example, the right singular vectors derived from computing the SVD will be equivalent to the principal components we have calculated. We can see that this is the case by first computing the SVD on our image matrix and comparing the right singular vectors to the result of PCA. As was the case with PCA, SVD computation is provided as a function on a distributed RowMatrix:
val svd = matrix.computeSVD(10, computeU = true) println(s"U dimension: (${svd.U.numRows}, ${svd.U.numCols})") Read now
Unlock full access