Github user mengxr commented on a diff in the pull request:

    https://github.com/apache/spark/pull/216#discussion_r10898309
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/mllib/discretization/EMDDiscretizerSuite.scala
 ---
    @@ -0,0 +1,60 @@
    +package org.apache.spark.mllib.discretization
    +
    +import org.scalatest.FunSuite
    +import org.apache.spark.mllib.util.LocalSparkContext
    +import org.apache.spark.rdd.RDD
    +import org.apache.spark.SparkContext._
    +import org.apache.spark.mllib.regression.LabeledPoint
    +import scala.util.Random
    +import org.apache.spark.mllib.util.InfoTheory
    +
    +object EMDDiscretizerSuite {
    +    val nFeatures = 5
    +    val nDatapoints = 50
    +    val nLabels = 3
    +    val nPartitions = 3
    +       
    +   def generateLabeledData : Array[LabeledPoint] =
    +   {
    +        
    +       val rnd = new Random(42)
    +       val labels = Array.fill[Double](nLabels)(rnd.nextDouble)
    +               
    +       Array.fill[LabeledPoint](nDatapoints) {
    +           LabeledPoint(labels(rnd.nextInt(nLabels)),
    +                        Array.fill[Double](nFeatures)(rnd.nextDouble))
    +       } 
    +   }
    +}
    +
    +class EMDDiscretizerSuite extends FunSuite with LocalSparkContext {
    +    
    +    test("EMD discretization") {
    +        val rnd = new Random()
    --- End diff --
    
    Use a fixed seed to make the test deterministic.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to