Github user MLnick commented on a diff in the pull request:
https://github.com/apache/spark/pull/17034#discussion_r102727229
--- 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(
--- End diff --
Technically I guess this could be part of `checkNumericTypes` similar to
checking weight and label cols, but since it is specific to AFT this is ok.
---
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]