zhengruifeng opened a new pull request, #57420: URL: https://github.com/apache/spark/pull/57420
### What changes were proposed in this pull request? This patch adds a model-owned `estimatedSize` implementation for `OneVsRestModel`. The estimate includes the model's parameter metadata, label metadata, and the estimates of its binary classification submodels. ### Why are the changes needed? Spark Connect uses `Model.estimatedSize` to enforce ML model-cache limits. `OneVsRestModel` was the only concrete classification model that inherited the default graph traversal. Its copied submodels retain their parent estimators, so that traversal can include shared Spark session/context state rather than only the cached model's data. The explicit estimate follows the established classifier-model pattern and accounts only for state owned by the One-vs-Rest model. ### Does this PR introduce _any_ user-facing change? Yes. Spark Connect cache accounting for One-vs-Rest models becomes more accurate, preventing shared runtime state from inflating the estimated model size. There is no public API change. ### How was this patch tested? Added a regression test that verifies the estimate is the sum of One-vs-Rest parameter metadata, label metadata, and its contained models' estimates. Ran: ``` JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 build/sbt 'mllib/testOnly *OneVsRestSuite' ``` All 17 tests passed. ### 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]
