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

Utils to format extraction of index and nunique of categorical columns #244

Closed
wants to merge 2 commits into from

Conversation

ekamioka
Copy link

@ekamioka ekamioka commented Dec 1, 2020

Implement auxiliary function to extract dict of indexes and unique values/dims

Usage:
    cat_dims = get_idxs_dims(df_train, cat_cols=categorical_features)

    clf = TabNetClassifier(cat_idxs=[x for x, _ in cat_dims.items()],
                                          cat_dims=[x for _, x in cat_dims.items()],
                                          )

maybe towards "cat_idxs and cat_dims are not required anymore"
    clf = TabNetClassifier(cat_cols=categorical_cols) 

What kind of change does this PR introduce?
Auxiliary function to allow internal/encapsulated extraction of indexes receiving only a list of categorical columns

Does this PR introduce a breaking change?
So far, nops

What needs to be documented once your changes are merged?
Please check comments in the code

@Optimox
Copy link
Collaborator

Optimox commented Dec 1, 2020

Thanks for your PR.

I think it's indeed an interesting feature to add to have some classical preprocessing function implemented inside the repo.

However, I think this should provide a bit more than just cat_dims.
It should probably give cat_idxs (as shown in your code above) and also cat_emb_dims with predefined methods like 'log' which whould create emb_dim = int(log(cat_dim) 'max_50' which would do emb_dim = min(50, cat_dim / 2) or something like that.

@ekamioka
Copy link
Author

ekamioka commented Dec 2, 2020

Thanks for your PR.

I think it's indeed an interesting feature to add to have some classical preprocessing function implemented inside the repo.

However, I think this should provide a bit more than just cat_dims.
It should probably give cat_idxs (as shown in your code above) and also cat_emb_dims with predefined methods like 'log' which whould create emb_dim = int(log(cat_dim) 'max_50' which would do emb_dim = min(50, cat_dim / 2) or something like that.

Agree, I am still experimenting with tabnet but will do some drafts in parallel before committing to this PR. Thanks Seb.

@Optimox
Copy link
Collaborator

Optimox commented Dec 13, 2020

@ekamioka are you still willing to improve on this? Or should I close it? I opened an issue on this topic #249 so that this idea won't be lost anyway.

@ekamioka
Copy link
Author

ekamioka commented Dec 14, 2020

@ekamioka are you still willing to improve on this? Or should I close it? I opened an issue on this topic #249 so that this idea won't be lost anyway.

yes, pushing soon. thanks for opening the issue.

@Optimox Optimox closed this Sep 20, 2022
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 this pull request may close these issues.

None yet

2 participants