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

Add order_by parameter to LabelEncoder #506

Closed
amontanez24 opened this issue May 10, 2022 · 0 comments · Fixed by #510
Closed

Add order_by parameter to LabelEncoder #506

amontanez24 opened this issue May 10, 2022 · 0 comments · Fixed by #510
Assignees
Labels
feature request Request for a new feature
Milestone

Comments

@amontanez24
Copy link
Contributor

amontanez24 commented May 10, 2022

Problem Description

As a user, it would be useful to be able to specify the type of ordering I want to use for the LabelEncoder.

Expected behavior

  • Add an init parameter called order_by
  • It should be a string with the following possible values:
    • None (default): Just use the order the values appear in. Same as current implementation
    • numerical_value: Order by the numerical value (ie. the numerically first number should be mapped to 1, so on and so forth)
    • alphabetical: Order strings alphabetically (ie. the alphabetically first string should be mapped to 1, so on and so forth)

Validation

  • During init, if the parameter is not None, 'numerical_value' or 'alphabetical', raise the following error:
    • Error: order_by must be one of the following values: None, 'numerical_value' or 'alphabetical'
  • During fit if the order_by value is 'numerical_value' but the data is not numerical, then raise the following error:
    • Error: The data must be numerical or able to be casted as a float if order_by is 'numerical_value'
  • During fit, if the order_by value is 'alphabetical' but the data is not a string, raise the following error:
    • Error: The data must be of type string if order_by is 'alphabetical'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request Request for a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant