-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
False alarm NotFittedError in transform for legacy OneHotEncoder #12680
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Months ago I fitted a OneHotEncoder in scikit-learn==0.19.1 and I stored the object in a pickle. So I manually adapted the object by doing: ohe._feature_indices_ = ohe.feature_indices_
ohe._active_features_ = ohe.active_features_
ohe._n_values_ = ohe.n_values_
ohe._n_values = ohe.n_values
ohe._legacy_mode = True (I didn't set This patch worked and passed all my internal tests. But now, I've updated to 0.20.1 and a NotFittedError is raised every time I call I don't know if my particular case worth a PR. If does, I'll be willing to submit it. |
So you're saying this applies to an encoder unpickled from 0.19? We don't claim to support that, unfortunately... |
Okay. Thanks anyway. |
So close? I'm pretty sure |
This happens when in 0.20.1 you unpickle a OneHotEncoder from 0.19.1. The unpickled encoder is fitted, but a NotFittedError is raised because of the Hope my explanation is understood (let me know if not) . However I understand that you don't claim to support that. |
Yeah, sorry, I don't think we want to try to support that as it opens a giant can of worms. |
Reported by @arnau126 at #12443 (comment):
I'm surprised we don't already have tests for this case. @arnau126, please submit a minimal verifiable example, or just a test case by which we can confirm the error and your fix. Or submit a pull request with your fix and a test.
The text was updated successfully, but these errors were encountered: