Skip to content

OrdinalEncoder imputes missing values with 0 instead of -1 #144

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
janmotl opened this issue Oct 21, 2018 · 2 comments
Closed

OrdinalEncoder imputes missing values with 0 instead of -1 #144

janmotl opened this issue Oct 21, 2018 · 2 comments

Comments

@janmotl
Copy link
Collaborator

janmotl commented Oct 21, 2018

Proposed fix:

  1. Change a line with transformed_column.fillna(0, inplace=True).
  2. Write a test to make sure that the error does not repeat.
  3. Truncate test_inverse_transform() - it is ok to raise an exception when the data were imputed.
@janmotl
Copy link
Collaborator Author

janmotl commented Oct 21, 2018

However, that breaks other encoders:

    def test_backward_encoder(self):
        X = pd.DataFrame({'name': ['Afghanistan', 'Albania', 'Algeria'],
                          'landmass': [5, 4, 3]})
        X_t = pd.DataFrame({'name': ['American-Samoa'],
                            'landmass': [6]})

        enc = encoders.BackwardDifferenceEncoder()
        result = enc.fit(X).transform(X_t)

@janmotl
Copy link
Collaborator Author

janmotl commented Feb 11, 2019

Solved by @JohnnyC08 .

@janmotl janmotl closed this as completed Feb 11, 2019
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

1 participant