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

    https://github.com/apache/spark/pull/11553#discussion_r57414488
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/feature/QuantileDiscretizerSuite.scala 
---
    @@ -17,72 +17,25 @@
     
     package org.apache.spark.ml.feature
     
    -import org.apache.spark.{SparkContext, SparkFunSuite}
    -import org.apache.spark.ml.attribute.{Attribute, NominalAttribute}
    +import org.apache.spark.SparkFunSuite
     import org.apache.spark.ml.util.DefaultReadWriteTest
     import org.apache.spark.mllib.util.MLlibTestSparkContext
    -import org.apache.spark.sql.{Row, SQLContext}
    +import org.apache.spark.sql.SQLContext
     
     class QuantileDiscretizerSuite
       extends SparkFunSuite with MLlibTestSparkContext with 
DefaultReadWriteTest {
     
    -  import org.apache.spark.ml.feature.QuantileDiscretizerSuite._
    -
    -  test("Test quantile discretizer") {
    -    checkDiscretizedData(sc,
    -      Array[Double](1, 2, 3, 3, 3, 3, 3, 3, 3),
    -      10,
    -      Array[Double](1, 2, 3, 3, 3, 3, 3, 3, 3),
    -      Array("-Infinity, 1.0", "1.0, 2.0", "2.0, 3.0", "3.0, Infinity"))
    -
    -    checkDiscretizedData(sc,
    -      Array[Double](1, 2, 3, 3, 3, 3, 3, 3, 3),
    -      4,
    -      Array[Double](1, 2, 3, 3, 3, 3, 3, 3, 3),
    -      Array("-Infinity, 1.0", "1.0, 2.0", "2.0, 3.0", "3.0, Infinity"))
    -
    -    checkDiscretizedData(sc,
    -      Array[Double](1, 2, 3, 3, 3, 3, 3, 3, 3),
    -      3,
    -      Array[Double](0, 1, 2, 2, 2, 2, 2, 2, 2),
    -      Array("-Infinity, 2.0", "2.0, 3.0", "3.0, Infinity"))
    -
    -    checkDiscretizedData(sc,
    -      Array[Double](1, 2, 3, 3, 3, 3, 3, 3, 3),
    -      2,
    -      Array[Double](0, 1, 1, 1, 1, 1, 1, 1, 1),
    -      Array("-Infinity, 2.0", "2.0, Infinity"))
    -
    -  }
    -
    -  test("Test getting splits") {
    -    val splitTestPoints = Array(
    -      Array[Double]() -> Array(Double.NegativeInfinity, 0, 
Double.PositiveInfinity),
    -      Array(Double.NegativeInfinity) -> Array(Double.NegativeInfinity, 0, 
Double.PositiveInfinity),
    -      Array(Double.PositiveInfinity) -> Array(Double.NegativeInfinity, 0, 
Double.PositiveInfinity),
    -      Array(Double.NegativeInfinity, Double.PositiveInfinity)
    -        -> Array(Double.NegativeInfinity, 0, Double.PositiveInfinity),
    -      Array(0.0) -> Array(Double.NegativeInfinity, 0, 
Double.PositiveInfinity),
    -      Array(1.0) -> Array(Double.NegativeInfinity, 1, 
Double.PositiveInfinity),
    -      Array(0.0, 1.0) -> Array(Double.NegativeInfinity, 0, 1, 
Double.PositiveInfinity)
    -    )
    -    for ((ori, res) <- splitTestPoints) {
    -      assert(QuantileDiscretizer.getSplits(ori) === res, "Returned splits 
are invalid.")
    -    }
    -  }
    -
    -  test("Test splits on dataset larger than minSamplesRequired") {
    +  test("Test observed number of buckets matches required number of 
buckets") {
         val sqlCtx = SQLContext.getOrCreate(sc)
         import sqlCtx.implicits._
     
    -    val datasetSize = QuantileDiscretizer.minSamplesRequired + 1
    +    val datasetSize = 100000
         val numBuckets = 5
    -    val df = sc.parallelize((1.0 to datasetSize by 
1.0).map(Tuple1.apply)).toDF("input")
    +    val df = sc.parallelize(1.0 to datasetSize by 
1.0).map(Tuple1.apply).toDF("input")
    --- End diff --
    
    minor: `by 1.0` is unnecessary


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to