You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "zhengruifeng (via GitHub)" <gi...@apache.org> on 2026/09/04 08:29:29 UTC
[PR] [SPARK-59247][ML] Optimize tree ensemble classification model transform closures [spark]
zhengruifeng opened a new pull request, #58519:
URL: https://github.com/apache/spark/pull/58519
### What changes were proposed in this pull request?
This PR reduces the transform closure size of `RandomForestClassificationModel` and
`GBTClassificationModel`. It is the tree-ensemble counterpart to #58454.
The column-expression prediction hooks snapshot only the root nodes, tree weights, class count,
loss, and thresholds needed by each requested output column. Companion-object helpers perform raw
prediction and probability conversion without retaining the complete model. A shared
`TreeEnsembleModel` helper similarly detaches leaf prediction from the model.
### Why are the changes needed?
The default probabilistic classifier hooks and existing leaf UDF invoke bound model methods. Their
closures therefore retain the complete model and parameter graph even though scoring only needs
the tree nodes and a small amount of immutable prediction state. This adds avoidable driver memory
pressure for long-lived Spark Connect servers.
### Does this PR introduce _any_ user-facing change?
No.
### How was this patch tested?
The following check passed:
```
build/sbt mllib/compile
```
No new tests were added because the existing `testPredictMethods` coverage in
`RandomForestClassifierSuite` and `GBTClassifierSuite` exercises all combinations of raw
prediction, probability, and prediction columns.
### Was this patch authored or co-authored using generative AI tooling?
Generated-by: Codex (GPT-5)
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
Re: [PR] [SPARK-59247][ML] Optimize tree ensemble classification model transform closures [spark]
Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng closed pull request #58519: [SPARK-59247][ML] Optimize tree ensemble classification model transform closures
URL: https://github.com/apache/spark/pull/58519
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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
Re: [PR] [SPARK-59247][ML] Optimize tree ensemble classification model transform closures [spark]
Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #58519:
URL: https://github.com/apache/spark/pull/58519#issuecomment-5563940842
**Merge Summary:**
- merged into master https://github.com/apache/spark/commit/bc54e7a2c19a1806aea0f79471471e72ce41b1b5
- merged into branch-4.x https://github.com/apache/spark/commit/8f31419299e4c1b129203f70ade9127257779b85
*Posted by `merge_spark_pr.py`*
--
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.
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
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