Skip to content
Snippets Groups Projects
Commit a94671a0 authored by a1singh's avatar a1singh Committed by Sean Owen
Browse files

[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.
parent 7bdc9219
No related branches found
No related tags found
No related merge requests found
...@@ -438,7 +438,7 @@ final class OnlineLDAOptimizer extends LDAOptimizer { ...@@ -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
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment