Skip to content

[SPARK-58253][ML][CONNECT] Add size estimates for RobustScalerModel, MinMaxScalerModel, MaxAbsScalerModel, and StandardScalerModel#57424

Closed
zhengruifeng wants to merge 4 commits into
apache:masterfrom
zhengruifeng:scalar-model-size-estimates-master-dev3
Closed

[SPARK-58253][ML][CONNECT] Add size estimates for RobustScalerModel, MinMaxScalerModel, MaxAbsScalerModel, and StandardScalerModel#57424
zhengruifeng wants to merge 4 commits into
apache:masterfrom
zhengruifeng:scalar-model-size-estimates-master-dev3

Conversation

@zhengruifeng

@zhengruifeng zhengruifeng commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Add explicit estimatedSize implementations for RobustScalerModel, MinMaxScalerModel, MaxAbsScalerModel, and StandardScalerModel. Each directly accounts for model metadata and its learned vectors via getSizeInBytes, rather than using a reflection-based object-graph walk.

Why are the changes needed?

SPARK-57521 already makes the default Model.estimatedSize estimate a parentless copy, avoiding parent-estimator and SparkSession traversal. These explicit implementations make size accounting cheaper and more precise for scalar models, and align them with models that already provide specialized estimates.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

  • Added fitted-model size bounds to the corresponding feature algorithm suites.
  • JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 build/sbt 'mllib/Test/compile'\n- Targeted suites were not run.\n\n### Was this patch authored or co-authored using generative AI tooling?\n\nGenerated-by: OpenAI Codex (GPT-5)

@zhengruifeng zhengruifeng changed the title [WIP][ML] Add size estimates for RobustScalerModel, MinMaxScalerModel, MaxAbsScalerModel, and StandardScalerModel [SPARK-58253][ML][CONNECT] Add size estimates for RobustScalerModel, MinMaxScalerModel, MaxAbsScalerModel, and StandardScalerModel Jul 22, 2026
@zhengruifeng
zhengruifeng marked this pull request as ready for review July 22, 2026 07:20
@uros-b

uros-b commented Jul 22, 2026

Copy link
Copy Markdown
Member

Thank you @zhengruifeng and @HyukjinKwon!

@dongjoon-hyun dongjoon-hyun left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, the PR description seems outdated. The parent-traversal issue described here was already fixed generically by SPARK-57521, which made the default Model.estimatedSize estimate a parentless copy of the model.

Fitted models retain their parent estimator. Estimating the whole reachable object graph can therefore count shared SparkSession or SparkContext state instead of only the model footprint.

So the actual contribution of this PR is rather: (a) a cheaper and more precise estimation that avoids the reflection-based SizeEstimator.estimate graph walk, and (b) consistency with the other models that already provide explicit estimatedSize implementations (e.g., FMClassificationModel, LinearSVCModel). Could you update the PR description accordingly, @zhengruifeng ?

@zhengruifeng

Copy link
Copy Markdown
Contributor Author

@dongjoon-hyun Thank you for the clarification. I updated the PR description to note that SPARK-57521 already handles parent traversal, and that this PR provides direct, more precise size accounting for these models.

zhengruifeng added a commit that referenced this pull request Jul 23, 2026
…MinMaxScalerModel, MaxAbsScalerModel, and StandardScalerModel

### What changes were proposed in this pull request?

Add explicit `estimatedSize` implementations for RobustScalerModel, MinMaxScalerModel, MaxAbsScalerModel, and StandardScalerModel. Each directly accounts for model metadata and its learned vectors via `getSizeInBytes`, rather than using a reflection-based object-graph walk.

### Why are the changes needed?

SPARK-57521 already makes the default `Model.estimatedSize` estimate a parentless copy, avoiding parent-estimator and SparkSession traversal. These explicit implementations make size accounting cheaper and more precise for scalar models, and align them with models that already provide specialized estimates.

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

- Added fitted-model size bounds to the corresponding feature algorithm suites.
- `JAVA_HOME=/usr/lib/jvm/java-17-openjdk-amd64 build/sbt 'mllib/Test/compile'`\n- Targeted suites were not run.\n\n### Was this patch authored or co-authored using generative AI tooling?\n\nGenerated-by: OpenAI Codex (GPT-5)

Closes #57424 from zhengruifeng/scalar-model-size-estimates-master-dev3.

Authored-by: Ruifeng Zheng <ruifengz@apache.org>
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
(cherry picked from commit 6daabb8)
Signed-off-by: Ruifeng Zheng <ruifengz@apache.org>
@zhengruifeng

Copy link
Copy Markdown
Contributor Author

Merge Summary:

Posted by merge_spark_pr.py

@zhengruifeng
zhengruifeng deleted the scalar-model-size-estimates-master-dev3 branch July 23, 2026 02:22
@dongjoon-hyun

Copy link
Copy Markdown
Member

Thank you, @zhengruifeng .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants