Repository: mahout
Updated Branches:
  refs/heads/master f4631528b -> 60bb75192


MAHOUT-1936 fix AsFactor allReduce block closes apache/mahout#278


Project: http://git-wip-us.apache.org/repos/asf/mahout/repo
Commit: http://git-wip-us.apache.org/repos/asf/mahout/commit/60bb7519
Tree: http://git-wip-us.apache.org/repos/asf/mahout/tree/60bb7519
Diff: http://git-wip-us.apache.org/repos/asf/mahout/diff/60bb7519

Branch: refs/heads/master
Commit: 60bb751926524b62be52f9b4c9d1c70d735a0afc
Parents: f463152
Author: rawkintrevo <[email protected]>
Authored: Mon Feb 6 22:05:21 2017 -0600
Committer: rawkintrevo <[email protected]>
Committed: Mon Feb 6 22:05:21 2017 -0600

----------------------------------------------------------------------
 .../mahout/math/algorithms/preprocessing/AsFactor.scala      | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/mahout/blob/60bb7519/math-scala/src/main/scala/org/apache/mahout/math/algorithms/preprocessing/AsFactor.scala
----------------------------------------------------------------------
diff --git 
a/math-scala/src/main/scala/org/apache/mahout/math/algorithms/preprocessing/AsFactor.scala
 
b/math-scala/src/main/scala/org/apache/mahout/math/algorithms/preprocessing/AsFactor.scala
index 9d8e10f..2e2a3dd 100644
--- 
a/math-scala/src/main/scala/org/apache/mahout/math/algorithms/preprocessing/AsFactor.scala
+++ 
b/math-scala/src/main/scala/org/apache/mahout/math/algorithms/preprocessing/AsFactor.scala
@@ -38,11 +38,13 @@ class AsFactor extends PreprocessorFitter {
 
     import org.apache.mahout.math.function.VectorFunction
     val factorMap = input.allreduceBlock(
-      { case (keys, block: Matrix) =>
+      { case (keys, block: Matrix) => block },
+      { case (oldM: Matrix, newM: Matrix) =>
         // someday we'll replace this with block.max: Vector
         // or better yet- block.distinct
-        dense(block.aggregateColumns( new VectorFunction {
-            def apply(f: Vector): Double = f.max
+
+        dense((oldM rbind newM).aggregateColumns( new VectorFunction {
+          def apply(f: Vector): Double = f.max
         }))
       })(0, ::)
     /*

Reply via email to