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

    https://github.com/apache/spark/pull/8836#discussion_r40126117
  
    --- Diff: 
mllib/src/test/scala/org/apache/spark/ml/regression/AFTSurvivalRegressionSuite.scala
 ---
    @@ -302,7 +320,44 @@ class AFTSurvivalRegressionSuite extends SparkFunSuite 
with MLlibTestSparkContex
         model.setQuantileProbabilities(quantileProbabilities)
         assert(model.predictQuantiles(features) ~== quantilePredictR relTol 
1E-3)
     
    -    model.transform(datasetMultivariate).select("features", 
"prediction").collect().foreach {
    +    model.setQuantilesCol("quantiles")
    +    model.transform(datasetMultivariate).select("features", "prediction", 
"quantiles")
    +      .collect().foreach {
    +      case Row(features: DenseVector, prediction1: Double, 
predictionQuantiles1: Vector) =>
    +        val lambda = math.exp(BLAS.dot(model.coefficients, features) + 
model.intercept)
    +        val k = 1 / model.scale
    +        val prediction2 = lambda
    +        val predictionQuantiles2 = 
Vectors.dense(model.getQuantileProbabilities.map {
    +          q => lambda * math.exp(math.log(-math.log(1 - q)) / k)
    +        })
    +        assert(prediction1 ~== prediction2 relTol 1E-5)
    +        assert(predictionQuantiles1 ~== predictionQuantiles2 relTol 1E-5)
    +    }
    +  }
    +
    +  test("aft survival regression w/o quantiles column") {
    +    val trainer = new AFTSurvivalRegression
    +
    +    val features = Vectors.dense(6.559282795753792)
    +    val quantileProbabilities = Array(0.1, 0.5, 0.9)
    +    val quantilePredict = Vectors.dense(0.1879174, 2.6801195, 14.5779394)
    +
    +    val model = trainer.fit(datasetUnivariate)
    +
    +    intercept[IllegalArgumentException] {
    --- End diff --
    
    We need to update this test after we put a default value for 
`quantileProbabilities` and update its validator.


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