You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mahout.apache.org by ra...@apache.org on 2017/02/07 03:56:55 UTC
mahout git commit: MAHOUT-1924 Propagate cacheHint in dssvd closes
apache/mahout#274
Repository: mahout
Updated Branches:
refs/heads/master 22c5e8648 -> fa9aeaccc
MAHOUT-1924 Propagate cacheHint in dssvd closes apache/mahout#274
Project: http://git-wip-us.apache.org/repos/asf/mahout/repo
Commit: http://git-wip-us.apache.org/repos/asf/mahout/commit/fa9aeacc
Tree: http://git-wip-us.apache.org/repos/asf/mahout/tree/fa9aeacc
Diff: http://git-wip-us.apache.org/repos/asf/mahout/diff/fa9aeacc
Branch: refs/heads/master
Commit: fa9aeacccc11e50a166d290521030305d51fa787
Parents: 22c5e86
Author: rawkintrevo <tr...@gmail.com>
Authored: Mon Feb 6 21:56:19 2017 -0600
Committer: rawkintrevo <tr...@gmail.com>
Committed: Mon Feb 6 21:56:19 2017 -0600
----------------------------------------------------------------------
.../mahout/math/decompositions/DSSVD.scala | 23 ++++++++++++--------
1 file changed, 14 insertions(+), 9 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/mahout/blob/fa9aeacc/math-scala/src/main/scala/org/apache/mahout/math/decompositions/DSSVD.scala
----------------------------------------------------------------------
diff --git a/math-scala/src/main/scala/org/apache/mahout/math/decompositions/DSSVD.scala b/math-scala/src/main/scala/org/apache/mahout/math/decompositions/DSSVD.scala
index 4b65ef4..d917d11 100644
--- a/math-scala/src/main/scala/org/apache/mahout/math/decompositions/DSSVD.scala
+++ b/math-scala/src/main/scala/org/apache/mahout/math/decompositions/DSSVD.scala
@@ -1,6 +1,6 @@
package org.apache.mahout.math.decompositions
-import org.apache.mahout.math.{Matrix, Matrices, Vector}
+import org.apache.mahout.math.{Matrices, Matrix, Vector}
import org.apache.mahout.math.scalabindings._
import RLikeOps._
import org.apache.mahout.math.drm._
@@ -22,13 +22,18 @@ object DSSVD {
* @return (U,V,s). Note that U, V are non-checkpointed matrices (i.e. one needs to actually use them
* e.g. save them to hdfs in order to trigger their computation.
*/
- def dssvd[K](drmA: DrmLike[K], k: Int, p: Int = 15, q: Int = 0):
+ def dssvd[K](drmA: DrmLike[K],
+ k: Int,
+ p: Int = 15,
+ q: Int = 0,
+ cacheHint: CacheHint.CacheHint = CacheHint.MEMORY_ONLY):
+
(DrmLike[K], DrmLike[Int], Vector) = {
// Some mapBlock() calls need it
implicit val ktag = drmA.keyClassTag
- val drmAcp = drmA.checkpoint()
+ val drmAcp = drmA.checkpoint(cacheHint)
val m = drmAcp.nrow
val n = drmAcp.ncol
@@ -48,11 +53,11 @@ object DSSVD {
case (keys, blockA) \u21d2
val blockY = blockA %*% Matrices.symmetricUniformView(n, r, omegaSeed)
keys \u2192 blockY
- }.checkpoint()
+ }.checkpoint(cacheHint)
var drmQ = dqrThin(drmY)._1
// Checkpoint Q if last iteration
- if (q == 0) drmQ = drmQ.checkpoint()
+ if (q == 0) drmQ = drmQ.checkpoint(cacheHint)
trace(s"dssvd:drmQ=${drmQ.collect}.")
@@ -60,21 +65,21 @@ object DSSVD {
// still be identically partitioned.
var drmBt = drmAcp.t %*% drmQ
// Checkpoint B' if last iteration
- if (q == 0) drmBt = drmBt.checkpoint()
+ if (q == 0) drmBt = drmBt.checkpoint(cacheHint)
trace(s"dssvd:drmB'=${drmBt.collect}.")
for (i \u2190 0 until q) {
drmY = drmAcp %*% drmBt
- drmQ = dqrThin(drmY.checkpoint())._1
+ drmQ = dqrThin(drmY.checkpoint(cacheHint))._1
// Checkpoint Q if last iteration
- if (i == q - 1) drmQ = drmQ.checkpoint()
+ if (i == q - 1) drmQ = drmQ.checkpoint(cacheHint)
// This on the other hand should be inner-join-and-map A'B optimization since A and Q_i are not
// identically partitioned anymore.`
drmBt = drmAcp.t %*% drmQ
// Checkpoint B' if last iteration
- if (i == q - 1) drmBt = drmBt.checkpoint()
+ if (i == q - 1) drmBt = drmBt.checkpoint(cacheHint)
}
val mxBBt:Matrix = drmBt.t %*% drmBt