Skip to content

ENH Add sample_weight parameter to OneHotEncoder's .fit #26330

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
wants to merge 14 commits into
base: main
Choose a base branch
from

Conversation

vitaliset
Copy link
Contributor

@vitaliset vitaliset commented May 5, 2023

Fixes #26248.

This PR adds sample_weight parameter to OneHotEncoder.fit function and calculate level frequencies using sample_weight sum instead of counting. Also, this enables the ranking of categories accordingly for the use of max_categories.

@vitaliset vitaliset marked this pull request as draft May 5, 2023 06:07
@github-actions
Copy link

github-actions bot commented Jun 23, 2023

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 7e0ea84. Link to the linter CI: here

@vitaliset vitaliset marked this pull request as ready for review June 23, 2023 04:15
@vitaliset
Copy link
Contributor Author

As I had to adapt to the #27381 PR related to the new array API (#26024 for details), this PR got a little bit denser. The failing CI is due to coverage. Anyway, before I continue to work on this PR, I think I need a review otherwise I might invest too much time into some path (maybe I already did that hahah) and have to change it all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add sample_weight parameter to OneHotEncoder.fit(...)
1 participant