Uh oh!
There was an error while loading. Please reload this page.
Add missing_only init param to all imputers. missing_only is used in combination w/ the variables param. - #698
Conversation
…imputation __init__.py
…riately revise unit test
Morgan-Sell
commented
Sep 22, 2023
hi @solegalli, When I'm guessing the latter because I can't think of a scenario in which we would want to eliminate variables that do not have missing values. If my intuition is correct, is the sole purpose of this new feature for computational efficiency? If not, what are the other objectives of this new feature? |
Morgan-Sell
commented
Sep 29, 2023
hola @solegalli, are you on vacation? Just wanted to see if you saw my question. No rush! I'm accustomed to your rapid responses, so I thought I check-in. |
solegalli
commented
Oct 10, 2023
Hey @Morgan-Sell
The aim is not to expand the feature space unnecessarily. If you add indicators for all variables, not just those with NA, you will end up with a lot of variables that just contain the value 0. Is this what you mean by efficiency? Cheers |
Morgan-Sell
commented
Oct 10, 2023
@solegalli, welcome back! Hope you enjoyed your "holiday" as they say on your side of the pond ;) Based on your explanation, it seems that the If this is the case, then should this functionality only reside in the AddMissingIndicator class? |
solegalli
commented
Oct 11, 2023
Its most meaningful / useful function is indeed for the MissingIndicator class. But we should add it in all imputers. It will play a role when variables =None. At the moment, when |
…er class. Add missing_only param to CategoricalEncoder __init__. All CategoricalEncoder tests pass.
Morgan-Sell
commented
Oct 12, 2023
I added |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| self.variables_ = find_all_variables(X, self.variables) | ||
| # identify variables with missing values | ||
| if self.missing_only and self.variables is None: |
There was a problem hiding this comment.
same as previous, we need to combine this with find_all_variables so it doesnt search twice.
There was a problem hiding this comment.
See my prior response. By implementing the elif approach, we'll encounter a similar issue. This time we only want categorical variables, but if we create a new elif then we'll have both categorical and numerical variables
solegalli
left a comment
There was a problem hiding this comment.
Hey @Morgan-Sell !
Thank you so much for the changes. This is well ahead in the development :)
I made a few code suggestions and added a few comments, so here I summarize the main things:
- for numerical imputers, when
variables=Noneand missing=True, it selects all numerical variables with nan - for categorical imputers, when variables=None and missing=True, it selects all categorical variables with nan
- for the transformer that adds missing indicators, or the random sample imputer, when variables=None and missing=True, it selects all all variables with nan
I think the function that you created needs a bit of refinement.
Morgan-Sell
commented
Oct 31, 2023
hi @solegalli, I responded to two of your comments. Once we agree on the approach, we will quickly move forward with this PR. It's, more or less, copying/pasting the agreed-upon approach on all transformers. |
…on between 'ignore_format' and 'missing_only'
hi @solegalli, i created two global functions to identify either categorical or numerical variables that have missing values. These functions incorporate the "check_or_find_all..." functions. I have one question about the ArbitraryImputer's fit() order of operations. See my above comment. I also saw that DropMissingData() already incorporates the In the meantime, I will implement the new code in the other imputation transformers. |
Morgan-Sell
commented
Nov 7, 2023
hi @solegalli, AddMissingIndicator() already has the Should I refactor the code so the AddMissingIndicator() code base has a similar structure to the other imputers? Or, keep the code as is? If you have time, take a look at the other imputers. We're almost there!!! |
Morgan-Sell
commented
Nov 15, 2023
hi @solegalli, Did you see my above questions regarding the AddMissingIndicator() class? |
Closes#388.
When
missing_only=Trueandvariables=None, all numerical variables that do not contain missing values will be omitted fromself.variables_.This functionality does not apply to categorical variables.