Repository navigation
Preserve DataFrame row alignment for array targets in FeatureSelector - #1136
Open
akshitkhokhani wants to merge 1 commit into
Open
akshitkhokhani wants to merge 1 commit into
akshitkhokhani wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FeatureSelector.fitgives ndarray targets a new default index even when the feature DataFrame has a different index. This breaks sklearn pipeline cross-validation with an index assertion. If the DataFrame instead has permuted integer index labels, selection can silently associate targets with the wrong rows and discard a predictive feature.Construct the target Series with the feature DataFrame's index so ndarray targets follow row order. Explicit Series targets keep their existing label alignment. The fit documentation clarifies both behaviors.
Adds regressions for nondefault and permuted indexes, reordered Series targets, and an actual sklearn pipeline cross-validation workflow. Related to the pipeline workflow discussed in #960; that issue does not establish this specific ndarray cause.
Validation: all 10 selector unit tests pass, including existing ndarray-input and multiclass cases. Both new tests fail before the fix. Black 22.12.0, isort 5.12.0 and
git diff --checkpass. No full-suite claim.