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

factor2integer or arbitrary transformations #185

Closed
kevinykuo opened this issue Aug 20, 2018 · 3 comments
Closed

factor2integer or arbitrary transformations #185

kevinykuo opened this issue Aug 20, 2018 · 3 comments

Comments

@kevinykuo
Copy link

kevinykuo commented Aug 20, 2018

Could we have a step_factor2int() or something similar to convert factors into integers? Ideally with a from parameter that specifies the indexing (e.g. 0- or 1- based). Use case here is feeding data into embedding layers of keras models.

Alternatively, maybe there can be a step_lambda() that takes a user defined function for random use cases like this?

@topepo
Copy link
Member

topepo commented Aug 20, 2018

Could we have a step_factor2int()

This goes against every notation that I hold dear... but I know why you need it for sparks so okay.

Alternatively, maybe there can be a step_lambda() that takes a user defined function for random use cases like this?

We'll be adding some dplyr steps like mutate and that would solve the issue too.

@kevinykuo
Copy link
Author

kevinykuo commented Aug 21, 2018

Actually, what we really need is a step_stringindexer() or a step_labelencoder(), which should be less cringy than step_factor2int(). These also exist in sklearn and Spark.

Either way, we'll be in a better state than the current workaround in the wild which is "step_string2factor(ordered = TRUE) %>% step_ordinalscore()".

topepo added a commit that referenced this issue Sep 4, 2018
@topepo topepo closed this as completed Sep 10, 2018
@github-actions
Copy link

github-actions bot commented Feb 24, 2021

This issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with a reprex https://reprex.tidyverse.org) and link to this issue.

@github-actions github-actions bot locked and limited conversation to collaborators Feb 24, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants