Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
change the way to generate the random seed in LDASuite
  • Loading branch information
lu-wang-dl committed Jun 4, 2018
commit 91fc11639d56cc3f283e383e589808b6ab9bd0f7
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ object LDASuite {
vocabSize: Int): DataFrame = {
val avgWC = 1 // average instances of each word in a doc
val sc = spark.sparkContext
val rng = new java.util.Random()
rng.setSeed(1)
val rdd = sc.parallelize(1 to rows).map { i =>
val rng = new java.util.Random()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor: you can use new java.util.random(i) direct

rng.setSeed(i)
Vectors.dense(Array.fill(vocabSize)(rng.nextInt(2 * avgWC).toDouble))
}.map(v => new TestRow(v))
spark.createDataFrame(rdd)
Expand Down