Skip to content

Commit ff0501b

Browse files
lu-wang-dlmengxr
authored andcommitted
[SPARK-24300][ML] change the way to set seed in ml.cluster.LDASuite.generateLDAData
## What changes were proposed in this pull request? Using different RNG in all different partitions. ## How was this patch tested? manually Please review http://spark.apache.org/contributing.html before opening a pull request. Author: Lu WANG <lu.wang@databricks.com> Closes #21492 from ludatabricks/SPARK-24300.
1 parent b24d3db commit ff0501b

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ object LDASuite {
3434
vocabSize: Int): DataFrame = {
3535
val avgWC = 1 // average instances of each word in a doc
3636
val sc = spark.sparkContext
37-
val rng = new java.util.Random()
38-
rng.setSeed(1)
3937
val rdd = sc.parallelize(1 to rows).map { i =>
38+
val rng = new java.util.Random(i)
4039
Vectors.dense(Array.fill(vocabSize)(rng.nextInt(2 * avgWC).toDouble))
4140
}.map(v => new TestRow(v))
4241
spark.createDataFrame(rdd)

0 commit comments

Comments
 (0)