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

Support None as a choice in CategoricalHyperParameters #152

Closed
pvk-developer opened this issue Dec 9, 2019 · 0 comments · Fixed by #149
Closed

Support None as a choice in CategoricalHyperParameters #152

pvk-developer opened this issue Dec 9, 2019 · 0 comments · Fixed by #149
Assignees
Milestone

Comments

@pvk-developer
Copy link
Collaborator

At the moment we can't use None as a category. In order to be able to use None OneHotEncoder fit values must be transformed to objects, also the categories must be specified during instantiation.

choices = [None, 'mse', 'mae']
choices = np.array(choices, dtype='object')
ohe = OneHotEncoder(categories=[choices], sparse=False)
ohe.fit(choices.reshape(-1, 1))
ohe.inverse_transform(values.astype('object'))
ohe._encoder.transform(values.astype('object')).astype(int)
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

Successfully merging a pull request may close this issue.

1 participant