diff options
Diffstat (limited to 'mllib')
-rw-r--r-- | mllib/src/main/scala/org/apache/spark/mllib/linalg/sparsesvd.scala | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/mllib/src/main/scala/org/apache/spark/mllib/linalg/sparsesvd.scala b/mllib/src/main/scala/org/apache/spark/mllib/linalg/sparsesvd.scala index 0ab05de872..83b2178c09 100644 --- a/mllib/src/main/scala/org/apache/spark/mllib/linalg/sparsesvd.scala +++ b/mllib/src/main/scala/org/apache/spark/mllib/linalg/sparsesvd.scala @@ -65,12 +65,10 @@ object SVD { throw new IllegalArgumentException("Expecting a tall and skinny matrix") } - if (min_svalue < 1.0e-9) { - throw new IllegalArgumentException("Minimum singular value must be greater than 1e-9") + if (min_svalue < 1.0e-8) { + throw new IllegalArgumentException("Minimum singular value requested must be greater than 1e-9") } - val sc = data.sparkContext - // Compute A^T A, assuming rows are sparse enough to fit in memory val rows = data.map(entry => (entry._1._1, (entry._1._2, entry._2))).groupByKey().cache() @@ -80,7 +78,6 @@ object SVD { ((colind1, colind2), mval1*mval2) } } }.reduceByKey(_+_) - // Construct jblas A^T A locally val ata = DoubleMatrix.zeros(n, n) for(entry <- emits.toArray) { @@ -97,6 +94,8 @@ object SVD { throw new Exception("All singular values are smaller than min_svalue: " + min_svalue) } + val sc = data.sparkContext + // prepare V for returning val retV = sc.makeRDD( Array.tabulate(V.rows, sigma.length){ (i,j) => |