Skip to content
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

BUG: Fix identification of deserialized np.nan #15

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rbowden91
Copy link

I believe the bug is the same as:

scikit-learn/scikit-learn#11462

Basically, after serializing and deserializing a KNN or Forest imputer, it fails to transform new data, crashing with:

File "/home/rbowden/.local/share/virtualenvs/qls_py-a_jz9n52/lib/python3.7/site-packages/missingpy/missforest.py", line 505, in transform
force_all_finite=force_all_finite, copy=self.copy)
File "/home/rbowden/.local/share/virtualenvs/qls_py-a_jz9n52/lib/python3.7/site-packages/sklearn/utils/validation.py", line 542, in check_array
allow_nan=force_all_finite == 'allow-nan')
File "/home/rbowden/.local/share/virtualenvs/qls_py-a_jz9n52/lib/python3.7/site-packages/sklearn/utils/validation.py", line 56, in _assert_all_finite
raise ValueError(msg_err.format(type_err, X.dtype))
ValueError: Input contains NaN, infinity or a value too large for dtype('float64').

The temporary fix in my code had been:

imputer.missing_values = np.nan

But I believe this patch fixes the issue within missingpy itself (or at least, fixes that particular issue on my end).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant