Github user mengxr commented on a diff in the pull request:
https://github.com/apache/spark/pull/8836#discussion_r40125908
--- Diff:
mllib/src/test/scala/org/apache/spark/ml/regression/AFTSurvivalRegressionSuite.scala
---
@@ -167,10 +169,18 @@ class AFTSurvivalRegressionSuite extends
SparkFunSuite with MLlibTestSparkContex
model.setQuantileProbabilities(quantileProbabilities)
assert(model.predictQuantiles(features) ~== quantilePredictR relTol
1E-3)
- model.transform(datasetUnivariate).select("features",
"prediction").collect().foreach {
- case Row(features: DenseVector, prediction1: Double) =>
- val prediction2 = math.exp(BLAS.dot(model.coefficients, features)
+ model.intercept)
+ model.setQuantilesCol("quantiles")
+ model.transform(datasetUnivariate).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)
--- End diff --
I'm not sure whether this block is useful or not. We already verified that
`model.predict` and `model.predictQuantiles` work correctly. So here we only
need to verify the output values are indeed `prediction` and `quantiles`. So we
could use `model.predict` and `model.predictQuantiles` here::
~~~scala
model.transform(datasetUnivariate).select("features", "prediction",
"quantiles")
.collect().foreach {
case Row(features: Vector, prediction: Double, quantiles: Vector) =>
assert(prediction ~== model.predict(features) relTol 1E-5)
assert(quantiles ~== model.predictQuantiles(features) relTol 1E-5)
}
~~~
Also note the indentation.
---
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]