Github user imatiach-msft commented on a diff in the pull request:

    https://github.com/apache/spark/pull/17034#discussion_r103853075
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/regression/AFTSurvivalRegressionSuite.scala
 ---
    @@ -361,6 +363,36 @@ class AFTSurvivalRegressionSuite
           }
       }
     
    +  test("should support all NumericType censors, and not support other 
types") {
    +    val df = spark.createDataFrame(Seq(
    +      (0, Vectors.dense(0)),
    +      (1, Vectors.dense(1)),
    +      (2, Vectors.dense(2)),
    +      (3, Vectors.dense(3)),
    +      (4, Vectors.dense(4))
    +    )).toDF("label", "features")
    +      .withColumn("censor", lit(0.0))
    +    val aft = new AFTSurvivalRegression().setMaxIter(1)
    +    val expected = aft.fit(df)
    +
    +    val types = Seq(ShortType, LongType, IntegerType, FloatType, ByteType, 
DecimalType(10, 0))
    +    types.foreach { t =>
    +      val actual = aft.fit(df.select(col("label"), col("features"),
    +        col("censor").cast(t)))
    +      assert(expected.intercept === actual.intercept)
    +      assert(expected.coefficients === actual.coefficients)
    +    }
    +
    +    val dfWithStringCensors = spark.createDataFrame(Seq(
    +      (0, Vectors.dense(0, 2, 3), "0")
    +    )).toDF("label", "features", "censor")
    +    val thrown = intercept[IllegalArgumentException] {
    --- End diff --
    
    can you wrap this in a withClue("Column censor must be of type NumericType 
but was actually of type StringType") {
    ...
    }


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

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

Reply via email to