Repository navigation
Fix TransformerChain enumeration and improve validation diagnostics - #7696
Conversation
|
@copilot , try again |
Co-authored-by: rosebyte <14963300+rosebyte@users.noreply.github.com>
Co-authored-by: rosebyte <14963300+rosebyte@users.noreply.github.com>
Implemented fixes in 49fe5d6 and 1f8c021: The full article and mirrors remain inaccessible from this environment, so this is a partial resolution. Please attach the article’s remaining findings so I can verify them. CodeQL was attempted but skipped because the database is too large. |
Co-authored-by: rosebyte <14963300+rosebyte@users.noreply.github.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #7696 +/- ##
==========================================
+ Coverage 70.26% 70.27% +0.01%
==========================================
Files 1419 1420 +1
Lines 272603 272679 +76
Branches 27940 27944 +4
==========================================
+ Hits 191544 191628 +84
- Misses 73643 73645 +2
+ Partials 7416 7406 -10
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
|
@copilot, tighten #7696 based on the review below. The aim is a small, worthwhile PR, not to fix every warning in the original article. Keep these changes:
Prune low-value coverage:
Correct the PR’s claims:
Keep the edits surgical and update the existing PR rather than opening another one. Run the smallest relevant existing tests for the changed coverage, using available build prerequisites; do not launch a full-repository build. If validation is blocked, report the blocker rather than claiming success. Summarise what you retained, removed and corrected in the PR description. Use British English and no em dashes. |
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The targeted fixes are consistent with their contracts and include appropriate regression coverage.
Review effort: Balanced
Findings: None
What changed in this PR
Fixes PVS-Studio findings involving null handling, repeated enumeration, validation messages, metadata checks, and LDA argument ordering.
Changes:
- Corrects chain and LDA argument handling.
- Fixes FastTree and pipeline-ensemble validation.
- Adds regression tests for corrected behavior.
| File | Description |
|---|---|
test/Microsoft.ML.Tests/TrainerEstimators/TreeEstimators.cs |
Tests FastTree histogram-pool validation. |
test/Microsoft.ML.Tests/ChainTests.cs |
Tests empty and single-enumeration chains. |
test/Microsoft.ML.Core.Tests/UnitTests/TestEntryPoints.cs |
Tests ensemble metadata validation. |
src/Microsoft.ML.Transforms/Text/LdaTransform.cs |
Corrects LDA allocation argument order. |
src/Microsoft.ML.Transforms/Text/LdaSingleBox.cs |
Aligns managed and native LDA arguments. |
src/Microsoft.ML.FastTree/BoostingFastTree.cs |
Removes contradictory duplicate validation. |
src/Microsoft.ML.Ensemble/PipelineEnsemble.cs |
Makes metadata comparison null-safe. |
src/Microsoft.ML.Data/DataLoadSave/TransformerChain.cs |
Avoids enumerating transformers twice. |
src/Microsoft.ML.Data/DataLoadSave/EstimatorChain.cs |
Uses the null-safe estimator array. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Is the PR description up to date? I see
But based on the code it looks like it's already done. |
Fixes dotnet/machinelearning#6321.
Behaviour fixes
LastTransformerfrom the materialised array rather than enumerating the input again. This handles null and empty inputs, supports single-use and consuming enumerables, and ensuresLastTransformerrefers to a transformer actually stored in the chain.Behaviour-preserving clean-up
LastEstimatorfrom the stored estimator array for consistency. Supported construction paths already supply a non-null array to this private constructor.Out of scope
The remaining findings involving scalar-input error handling in
LdaTransform.Train, uncalibrated inputs inTreeEnsembleCombiner, and subchannel ID/depth ordering inProgressReporterare unchanged. They require separate assessment of caller invariants and code reachability.