spark-reviews mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jkbradley <...@git.apache.org>
Subject [GitHub] spark pull request: [SPARK-2199] [mllib] topic modeling
Date Tue, 30 Dec 2014 21:36:20 GMT
Github user jkbradley commented on the pull request:

    https://github.com/apache/spark/pull/1269#issuecomment-68401156
  
    @akopich The right way to do pseudo-randomness is to do:
    ```
    val randomSeed = ... // if you want to pass in a seed
    indx.mapPartitionsWithIndex { case (partitionIndex, iterator) =>
      // Use the partition index to make a different but deterministic seed for each partition.
      val random = new java.util.Random(partitionIndex + randomSeed)
      iterator.map(random.nextInt)
    }
    ```
    You can find examples in, e.g., mllib/tree/impl/BaggedPoint.scala



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


Mime
View raw message