Skip to content

Bug in a CategorialImputer test. #86

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

Closed
arnau126 opened this issue Apr 10, 2017 · 4 comments
Closed

Bug in a CategorialImputer test. #86

arnau126 opened this issue Apr 10, 2017 · 4 comments

Comments

@arnau126
Copy link
Collaborator

arnau126 commented Apr 10, 2017

CategorialImputer tests are not actually testing the feature when input_type is 'np' and none_value is np.nan.

This is because of the use of np.asarray. This function infers the data type and in this case it is casting the np.nan to string.

In explanation:

In [1]:  data = ['a', 'b', 'b', np.nan]

In [2]: X = np.asarray(data)

In [3]: X
Out [3]: array(['a', 'b', 'b', 'nan'], 
            dtype='|S3')

So, in this case, there is no null-like value and the imputer is doing nothing.

@dukebody
Copy link
Collaborator

Thanks @arnau126 ! Can you submit a PR to fix this?

@dukebody
Copy link
Collaborator

If you have any other improvements to the CategoricalImputer in mind (you probably do) please chime in on that as well.

@arnau126
Copy link
Collaborator Author

Yes, I do :)
PR: #87

@dukebody
Copy link
Collaborator

dukebody commented May 13, 2017

Fixed in #89.

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

No branches or pull requests

2 participants