Skip to content

Commit

Permalink
documentation and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rezazadeh committed Mar 20, 2014
1 parent b025ab2 commit 3f23271
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 5 deletions.
4 changes: 0 additions & 4 deletions mllib/src/main/scala/org/apache/spark/mllib/linalg/PCA.scala
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,11 @@ class PCA {
* singular value decomposition (SVD) algorithm.
*
* @param matrix dense matrix to perform PCA on
* @param k Recover k principal components
* @return An nxk matrix with principal components in columns. Columns are inner arrays
*/
private def computePCA(matrix: TallSkinnyDenseMatrix): Array[Array[Double]] = {
val m = matrix.m
val n = matrix.n
val sc = matrix.rows.sparkContext

if (m <= 0 || n <= 0) {
throw new IllegalArgumentException("Expecting a well-formed matrix: m=$m n=$n")
Expand All @@ -90,12 +88,10 @@ class PCA {
* singular value decomposition (SVD) algorithm.
*
* @param matrix dense matrix to perform pca on
* @param k Recover k principal components
* @return An nxk matrix of principal components
*/
private def computePCA(matrix: RDD[Array[Double]]): Array[Array[Double]] = {
val n = matrix.first.size
val sc = matrix.sparkContext

// compute column sums and normalize matrix
val colSumsTemp = matrix.map((_, 1)).fold((Array.ofDim[Double](n), 0)) { (a, b) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ class SVD {
throw new IllegalArgumentException("Must request up to n singular values")
}

// Compute A^T A, assuming rows are sparse enough to fit in memory
// Compute A^T A, assuming rows are sparse enough to fit in memory
val rows = data.map(entry =>
(entry.i, (entry.j, entry.mval))).groupByKey()
val emits = rows.flatMap{ case (rowind, cols) =>
Expand Down

0 comments on commit 3f23271

Please sign in to comment.