Skip to content

Handle missing values in OrdinalEncoder #11997

Closed

Description

@jnothman

A minimal implementation would pass through NaNs from the input to the output of transform and make sure the presence of NaN does not affect the categories identified in fit.

A missing_values parameter might allow the user to configure what object is a placeholder for missingness (e.g. NaN, None, etc.).

See #10465 for background

Activity

  1. added
    Easy
    good first issue
    on Sep 4, 2018
  2. maxcopeland commented on Sep 4, 2018

    @maxcopeland
    Contributor

    Hi @jnothman-- do you mind if I work on this?

  3. jnothman commented on Sep 4, 2018

    @jnothman
    MemberAuthor

    Go for it

  4. jnothman commented on Sep 4, 2018

    @jnothman
    MemberAuthor

    I suppose we might also consider a handle_missing param that would allow NaN to be encoded as the smallest/largest number...?

  5. jashrathod commented on Sep 8, 2018

    @jashrathod

    Hi.
    I'm new so open source contributions. So can someone help me get started?

  6. maxcopeland commented on Sep 8, 2018

    @maxcopeland
    Contributor

    I'm currently working on this issue-- but I think the best way to start is to review the contributing guidlines. And when you see an issue no one is working on, ask the member who submitted the issue if you can get started. (I'm fairly new to this project myself).

  7. CatChenal commented on Sep 29, 2018

    @CatChenal
    Contributor

    I wish the help wanted tag would disappear once a contributor adopts an issue...

  8. shashvat-kedia commented on Apr 1, 2019

    @shashvat-kedia

    @jnothman I am new to this project and would like to contribute. Can I start by working on this issue?

  9. jnothman commented on Apr 1, 2019

    @jnothman
    MemberAuthor
  10. removed
    Easy
    good first issue
    on Apr 1, 2019
  11. Catadanna commented on Sep 17, 2019

    @Catadanna

    A suggestion: assign 0 only for missing values, and starting encoding from 1 (and not from 0 as it is done now), even when there are no missing values in the data set. Such a normalization could help identifying the preceding missing values more easier (in order to handle them).

  12. glemaitre commented on Nov 13, 2019

    @glemaitre
    Member

    By adding the option add_indicator in the imputer, we also make things difficult right now.
    Indeed, one will have to define a pipeline imputer+encoder. If add_indicator=True, we will get some extra-columns which you don't want to encode.

    The workaround is to make a column transform with a MissingIndicator and set add_indicator=False for the imputer.

    A reasonable use case would be to first encode ignoring the missing values and then apply the imputer.

    I might pick up this and make some reviews on the different PRs

    EDIT: Since we will encode the missing values as a caregories, we will not need add_indicator=True in practise.

  13. thomasjpfan commented on Feb 23, 2023

    @thomasjpfan
    Member

    I am closing this PR because this feature was added in #21988, which added encoded_missing_value to choose the encoding for missing values.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions