[SPARK-11506][MLLIB] Removed redundant operation in Online LDA implementation

In file LDAOptimizer.scala:

line 441: since "idx" was never used, replaced unrequired zipWithIndex.foreach with foreach.

-      nonEmptyDocs.zipWithIndex.foreach { case ((_, termCounts: Vector), idx: Int) =>
+      nonEmptyDocs.foreach { case (_, termCounts: Vector) =>

Author: a1singh <a1singh@ucsd.edu>

Closes #9456 from a1singh/master.
This commit is contained in:
a1singh 2015-11-05 12:51:10 +00:00 committed by Sean Owen
parent 7bdc92197c
commit a94671a027

View file

@ -438,7 +438,7 @@ final class OnlineLDAOptimizer extends LDAOptimizer {
val stat = BDM.zeros[Double](k, vocabSize) val stat = BDM.zeros[Double](k, vocabSize)
var gammaPart = List[BDV[Double]]() var gammaPart = List[BDV[Double]]()
nonEmptyDocs.zipWithIndex.foreach { case ((_, termCounts: Vector), idx: Int) => nonEmptyDocs.foreach { case (_, termCounts: Vector) =>
val ids: List[Int] = termCounts match { val ids: List[Int] = termCounts match {
case v: DenseVector => (0 until v.size).toList case v: DenseVector => (0 until v.size).toList
case v: SparseVector => v.indices.toList case v: SparseVector => v.indices.toList