Thanks to visit codestin.com
Credit goes to github.com

Skip to content

OrdinalEncoder: Deprecate automatically assuming lexicographic ordering #14954

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

Open
jnothman opened this issue Sep 11, 2019 · 7 comments
Open
Labels
Easy Well-defined and straightforward way to resolve module:preprocessing

Comments

@jnothman
Copy link
Member

Currently, using OrdinalEncoder with a string-valued feature, and without categories explicitly specifying an order, means that OrdinalEncoder will number the categories according to their lexicographic ordering.

This is not appropriate if the categories have a natural ordering (e.g. ['Green', 'Amber', 'Red']) that can be harnessed by the downstream estimator.

Rather, we should allow the user to specify categories='arbitrary' or categories='lexicographic' or something to explicitly state that lexicographic ordering is okay. When the user specifies categories='auto' for a string-valued feature, OrdinalEncoder should raise a warning along the lines of DeprecationWarning("From version 0.24, OrdinalEncoder's categories='auto' setting will not work with string-valued features, and categories='arbitrary' or an explicit category order will be required.")

@venkyyuvy
Copy link
Contributor

Can I work on this?

@jnothman
Copy link
Member Author

jnothman commented Sep 12, 2019 via email

@Alexrand1
Copy link

Can you point me to where the file is located in the repo?

@PyExtreme
Copy link
Contributor

Hi, @venkyyuvy , Are you still working on this? Since, I am also interested to contribute.

Thanks

@venkyyuvy
Copy link
Contributor

yes @PyExtreme
I had raised a PR already, waiting for reviews!

@glemaitre
Copy link
Member

I think that #14984, #15050, and #15396 might not be blockers for 0.22 and I would move them for 0.23.

I think that it could be great to have a single issue (superseded #14953, #14954) to discuss the overall behaviour for categories in OneHotEncoder and OrdinalEncoder and from there having several PRs which follows the discussed proposals.

jawadjawid added a commit to jawadjawid/scikit-learn that referenced this issue Mar 13, 2021
jawadjawid added a commit to jawadjawid/scikit-learn that referenced this issue Mar 13, 2021
@yahoyoungho
Copy link

@glemaitre Hi, random suggestion but what the function has a parameter named mapping that takes in a dictionary with keys being strings or some type of data and values being integers (either in a float or int form)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Easy Well-defined and straightforward way to resolve module:preprocessing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants