Skip to content

Guard unsupported pipeline sample weights - #2153

Merged
FlorianPfaff merged 2 commits into
mainfrom
agent/guard-unsupported-pipeline-sample-weight
Aug 10, 2026
Merged

Guard unsupported pipeline sample weights#2153
FlorianPfaff merged 2 commits into
mainfrom
agent/guard-unsupported-pipeline-sample-weight

Conversation

@FlorianPfaff

Copy link
Copy Markdown
Member

What changed

  • Only wrap scikit-learn Pipeline estimators when their final estimator explicitly accepts sample_weight.
  • Preserve the existing unweighted fallback for pipelines such as StandardScalerKNeighborsClassifier instead of forwarding an unsupported keyword and failing during fit().
  • Add a regression test alongside the existing supported-pipeline routing test.

Root cause

The runtime adapter wrapped every pipeline whenever sample_weight was supplied. Its fit() method then unconditionally forwarded <final_step>__sample_weight, even when the final estimator did not expose that parameter. This bypassed the capability check already used by the core random-subspace implementation.

Validation

  • Diff is limited to the sample-weight adapter and its focused test file.
  • The new test exercises an unsupported final estimator and asserts the ensemble still fits and predicts.
  • Full repository validation is delegated to GitHub Actions because the local runtime does not provide the GitHub CLI or a network-accessible checkout.

@FlorianPfaff
FlorianPfaff marked this pull request as ready for review August 6, 2026 05:56
@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 6, 2026 05:57
@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Warnings Elapsed time
✅ ACTION actionlint 29 0 0 1.22s
✅ COPYPASTE jscpd yes no no 3.96s
✅ MARKDOWN markdownlint 141 0 0 0 2.5s
✅ PYTHON ruff 1558 0 0 0 0.62s
✅ REPOSITORY git_diff yes no no 0.14s
✅ YAML prettier 70 0 0 0 2.3s
✅ YAML v8r 70 0 0 8.12s
✅ YAML yamllint 70 0 0 1.49s

Notices

📣 MegaLinter 9.5.0 is out! Discover the new features and security recommendations in the release announcement. (Skip this info by defining SECURITY_SUGGESTIONS: false)

See detailed reports in MegaLinter artifacts

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@github-actions

github-actions Bot commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

Test Results

     4 files  ±0       4 suites  ±0   4m 41s ⏱️ -2s
 6 866 tests +1   6 828 ✅ +16   38 💤 ±0  0 ❌  - 15 
27 472 runs  +4  27 320 ✅ +64  152 💤 ±0  0 ❌  - 60 

Results for commit c0a7f78. ± Comparison against base commit 67e9a68.

♻️ This comment has been updated with latest results.

auto-merge was automatically disabled August 9, 2026 15:59

Pull request was closed

@FlorianPfaff FlorianPfaff reopened this Aug 9, 2026
@FlorianPfaff
FlorianPfaff enabled auto-merge (squash) August 9, 2026 16:01
@FlorianPfaff
FlorianPfaff merged commit 22ac3f5 into main Aug 10, 2026
24 of 32 checks passed
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.

1 participant