Repository: mahout Updated Branches: refs/heads/master fcb436d2a -> 11046fb52
NOJIRA: switching AlS to mahout's random from scala random to ensure deterministic test for the time being. Project: http://git-wip-us.apache.org/repos/asf/mahout/repo Commit: http://git-wip-us.apache.org/repos/asf/mahout/commit/11046fb5 Tree: http://git-wip-us.apache.org/repos/asf/mahout/tree/11046fb5 Diff: http://git-wip-us.apache.org/repos/asf/mahout/diff/11046fb5 Branch: refs/heads/master Commit: 11046fb5273b559298111b201470d80cd6af43d9 Parents: fcb436d Author: Dmitriy Lyubimov <[email protected]> Authored: Mon Jun 9 12:17:00 2014 -0700 Committer: Dmitriy Lyubimov <[email protected]> Committed: Mon Jun 9 12:17:00 2014 -0700 ---------------------------------------------------------------------- .../main/scala/org/apache/mahout/math/decompositions/ALS.scala | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/mahout/blob/11046fb5/math-scala/src/main/scala/org/apache/mahout/math/decompositions/ALS.scala ---------------------------------------------------------------------- diff --git a/math-scala/src/main/scala/org/apache/mahout/math/decompositions/ALS.scala b/math-scala/src/main/scala/org/apache/mahout/math/decompositions/ALS.scala index eaefe0e..5103e1c 100644 --- a/math-scala/src/main/scala/org/apache/mahout/math/decompositions/ALS.scala +++ b/math-scala/src/main/scala/org/apache/mahout/math/decompositions/ALS.scala @@ -26,6 +26,7 @@ import RLikeOps._ import scala.util.Random import org.apache.log4j.Logger import math._ +import org.apache.mahout.common.RandomUtils /** Simple ALS factorization algotithm. To solve, use train() method. */ object ALS { @@ -79,13 +80,15 @@ object ALS { assert(convergenceThreshold < 1.0, "convergenceThreshold") assert(maxIterations >= 1, "maxIterations") + val drmA = drmInput val drmAt = drmInput.t // Initialize U and V so that they are identically distributed to A or A' var drmU = drmA.mapBlock(ncol = k) { case (keys, block) => - val uBlock = Matrices.symmetricUniformView(block.nrow, k, Random.nextInt()) * 0.01 + val rnd = RandomUtils.getRandom() + val uBlock = Matrices.symmetricUniformView(block.nrow, k, rnd.nextInt()) * 0.01 keys -> uBlock }
