Skip to content

Commit 0c81c45

Browse files
author
Feynman Liang
committed
Pull out k in tests
1 parent 5eb2430 commit 0c81c45

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

mllib/src/test/scala/org/apache/spark/mllib/clustering/LDASuite.scala

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,11 +310,12 @@ class LDASuite extends SparkFunSuite with MLlibTestSparkContext {
310310
Vectors.sparse(6, Array(4, 5), Array(1, 1))
311311
).zipWithIndex.map { case (wordCounts, docId) => (docId.toLong, wordCounts) }
312312

313+
val k = 2
313314
val docs = sc.parallelize(toydata)
314315
val op = new OnlineLDAOptimizer().setMiniBatchFraction(1).setTau0(1024).setKappa(0.51)
315316
.setGammaShape(1e10).setOptimzeAlpha(true)
316-
val lda = new LDA().setK(2)
317-
.setDocConcentration(0.01)
317+
val lda = new LDA().setK(k)
318+
.setDocConcentration(1D / k)
318319
.setTopicConcentration(0.01)
319320
.setMaxIterations(100)
320321
.setOptimizer(op)

0 commit comments

Comments
 (0)