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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to