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

    https://github.com/apache/spark/pull/11553#discussion_r57414489
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/feature/QuantileDiscretizerSuite.scala 
---
    @@ -91,6 +44,46 @@ class QuantileDiscretizerSuite
           "Observed number of buckets does not equal expected number of 
buckets.")
       }
     
    +  test("Test transform method on unseen data") {
    +    val sqlCtx = SQLContext.getOrCreate(sc)
    +    import sqlCtx.implicits._
    +
    +    val trainDF = sc.parallelize(1.0 to 100.0 by 
1.0).map(Tuple1.apply).toDF("input")
    +    val testDF = sc.parallelize(-10.0 to 110.0 by 
1.0).map(Tuple1.apply).toDF("input")
    +    val discretizer = new QuantileDiscretizer()
    +      .setInputCol("input")
    +      .setOutputCol("result")
    +      .setNumBuckets(5)
    +
    +    val result = discretizer.fit(trainDF).transform(testDF)
    +    val firstBucketSize = result.filter(result("result") === 0.0).count
    +    val lastBucketSize = result.filter(result("result") === 4.0).count
    +
    +    assert(firstBucketSize === 30L,
    +      "Size of first bucket did not equal expected value.")
    --- End diff --
    
    embed `firstBucketSize` and expected value in the error message


---
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