feat: add errors parameter to CategoricalImputer for multimodal variables#908
Open
direkkakkar319-ops wants to merge 7 commits intofeature-engine:mainfrom
Open
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #908 +/- ##
=======================================
Coverage 98.27% 98.27%
=======================================
Files 116 116
Lines 4978 4988 +10
Branches 795 800 +5
=======================================
+ Hits 4892 4902 +10
Misses 55 55
Partials 31 31 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Author
|
@solegalli facing issue with the 2 checks will work on this and move the PR for review in some time |
Author
|
the test pass percentage has increased still below the set benchmark |
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.
Description
Fixes #904
Adds an
errorsparameter toCategoricalImputerto handle multimodal categorical variables gracefully, instead of always raising aValueError.Changes
errorsparameter toCategoricalImputer.__init__()with options'raise'(default),'warn', and'ignore'.fit()to respect the new parametererrors='warn', emits aUserWarningand imputes using the first most frequent category founderrors='ignore', silently imputes using the first most frequent category founderrors='raise'preserves existing behaviour — no breaking changeserrorsvalues and invalid inputCHANGELOG.rstentryType of Change
Tests
All new and existing tests pass:
Notes
The existing error message (
"contains multiple frequent categories") is preserved so no existing test matchers break.