You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2020/10/10 11:01:31 UTC
[GitHub] [spark] zhengruifeng opened a new pull request #30000: [SPARK-33111][ML] aft transform optimization
zhengruifeng opened a new pull request #30000:
URL: https://github.com/apache/spark/pull/30000
### What changes were proposed in this pull request?
1, when `predictionCol` and `quantilesCol` are both set, we only need one prediction for each row: prediction is just the variable `lambda` in `predictQuantiles`;
2, in the computation of variable `quantiles` in `predictQuantiles`, a pre-computed vector `val baseQuantiles = $(quantileProbabilities).map(q => math.exp(math.log(-math.log1p(-q)) * scale))` can be reused for each row;
### Why are the changes needed?
avoid redundant computation in transform, like what we did in `ProbabilisticClassificationModel`, `GaussianMixtureModel`, etc
### Does this PR introduce _any_ user-facing change?
No
### How was this patch tested?
existing testsuite
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on a change in pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on a change in pull request #30000:
URL: https://github.com/apache/spark/pull/30000#discussion_r502999821
##########
File path: mllib/src/main/scala/org/apache/spark/ml/regression/AFTSurvivalRegression.scala
##########
@@ -421,9 +421,17 @@ class AFTSurvivalRegressionModel private[ml] (
}
if (hasQuantilesCol) {
- val predictQuantilesUDF = udf { features: Vector => predictQuantiles(features)}
+ val baseQuantiles = $(quantileProbabilities)
+ .map(q => math.exp(math.log(-math.log1p(-q)) * scale))
+ val lambdaCol = if ($(predictionCol).nonEmpty) {
Review comment:
if ($(predictionCol).nonEmpty), then `predictionColumns.head` is `predictUDF(col($(featuresCol))).as($(predictionCol), outputSchema($(predictionCol)).metadata)`, the predictionCol.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on a change in pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on a change in pull request #30000:
URL: https://github.com/apache/spark/pull/30000#discussion_r502999821
##########
File path: mllib/src/main/scala/org/apache/spark/ml/regression/AFTSurvivalRegression.scala
##########
@@ -421,9 +421,17 @@ class AFTSurvivalRegressionModel private[ml] (
}
if (hasQuantilesCol) {
- val predictQuantilesUDF = udf { features: Vector => predictQuantiles(features)}
+ val baseQuantiles = $(quantileProbabilities)
+ .map(q => math.exp(math.log(-math.log1p(-q)) * scale))
+ val lambdaCol = if ($(predictionCol).nonEmpty) {
Review comment:
```
if ($(predictionCol).nonEmpty) {
val predictUDF = udf { features: Vector => predict(features) }
predictionColNames :+= $(predictionCol)
predictionColumns :+= predictUDF(col($(featuresCol)))
.as($(predictionCol), outputSchema($(predictionCol)).metadata)
}
```
if ($(predictionCol).nonEmpty), then `predictionColumns.head` is `predictUDF(col($(featuresCol))).as($(predictionCol), outputSchema($(predictionCol)).metadata)`, the predictionCol.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706538319
Test FAILed.
Refer to this link for build results (access rights to CI server needed):
https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder-K8s/34228/
Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706531643
**[Test build #129624 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129624/testReport)** for PR 30000 at commit [`23b46b1`](https://github.com/apache/spark/commit/23b46b160e9dd69afcaaba0b69b5c949584d201c).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] srowen commented on a change in pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
srowen commented on a change in pull request #30000:
URL: https://github.com/apache/spark/pull/30000#discussion_r502815872
##########
File path: mllib/src/main/scala/org/apache/spark/ml/regression/AFTSurvivalRegression.scala
##########
@@ -421,9 +421,17 @@ class AFTSurvivalRegressionModel private[ml] (
}
if (hasQuantilesCol) {
- val predictQuantilesUDF = udf { features: Vector => predictQuantiles(features)}
+ val baseQuantiles = $(quantileProbabilities)
+ .map(q => math.exp(math.log(-math.log1p(-q)) * scale))
+ val lambdaCol = if ($(predictionCol).nonEmpty) {
Review comment:
I think you're probably right here but why is lambdaCol the first predictionCol here?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] srowen closed pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
srowen closed pull request #30000:
URL: https://github.com/apache/spark/pull/30000
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706538317
Merged build finished. Test FAILed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706539929
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706538311
Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34228/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706539929
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706531643
**[Test build #129624 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129624/testReport)** for PR 30000 at commit [`23b46b1`](https://github.com/apache/spark/commit/23b46b160e9dd69afcaaba0b69b5c949584d201c).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706538317
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-707425415
Thank you for reviewing!
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706539809
**[Test build #129624 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/129624/testReport)** for PR 30000 at commit [`23b46b1`](https://github.com/apache/spark/commit/23b46b160e9dd69afcaaba0b69b5c949584d201c).
* This patch passes all tests.
* This patch merges cleanly.
* This patch adds no public classes.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] srowen commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
srowen commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-707139230
Merged to master
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706531392
friendly ping @srowen @huaxingao
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #30000:
URL: https://github.com/apache/spark/pull/30000#issuecomment-706535801
Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/34228/
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] zhengruifeng commented on a change in pull request #30000: [SPARK-33111][ML] aft transform optimization
Posted by GitBox <gi...@apache.org>.
zhengruifeng commented on a change in pull request #30000:
URL: https://github.com/apache/spark/pull/30000#discussion_r502999821
##########
File path: mllib/src/main/scala/org/apache/spark/ml/regression/AFTSurvivalRegression.scala
##########
@@ -421,9 +421,17 @@ class AFTSurvivalRegressionModel private[ml] (
}
if (hasQuantilesCol) {
- val predictQuantilesUDF = udf { features: Vector => predictQuantiles(features)}
+ val baseQuantiles = $(quantileProbabilities)
+ .map(q => math.exp(math.log(-math.log1p(-q)) * scale))
+ val lambdaCol = if ($(predictionCol).nonEmpty) {
Review comment:
if ($(predictionCol).nonEmpty), then `predictionColumns.head` is `predictUDF(col($(featuresCol))).as($(predictionCol), outputSchema($(predictionCol)).metadata)`, the [predictionCol](https://github.com/apache/spark/pull/30000/files#diff-e277fd0bc21f825d3196b4551c01fe5fR419).
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org