-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
[AIR] Add KBinsDiscretizer
#28389
[AIR] Add KBinsDiscretizer
#28389
Conversation
Signed-off-by: Antoni Baum <[email protected]>
Signed-off-by: Antoni Baum <[email protected]>
Signed-off-by: Antoni Baum <[email protected]>
Signed-off-by: Antoni Baum <[email protected]>
@@ -74,6 +74,15 @@ Feature Scalers | |||
.. autoclass:: ray.data.preprocessors.StandardScaler | |||
:show-inheritance: | |||
|
|||
K-Bins Discretizers |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would a more-general Discretizers
be better? I see sklearn does something similar in their user guide https://scikit-learn.org/stable/modules/preprocessing.html#discretization
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, makes sense!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall LGTM. Left some minor suggestions and questions.
Could you see if you can reproduce my inconsistent output? https://github.com/ray-project/ray/pull/28389/files#r967751046
Co-authored-by: Balaji Veeramani <[email protected]> Signed-off-by: Antoni Baum <[email protected]>
Signed-off-by: Antoni Baum <[email protected]>
Co-authored-by: Balaji Veeramani <[email protected]> Signed-off-by: PaulFenton <[email protected]>
Signed-off-by: Antoni Baum [email protected]
Why are these changes needed?
K-Bins discretization is a common preprocessing step. This PR adds two new preprocessors -
CustomKBinsDiscretizer
andUniformKBinsDiscretizer
. The former uses user-defined bin edges and in the latter, the user provides a desired number of bins and uniform-width bins are created automatically. Both of those preprocessors are essentially thin wrappers aroundpandas.cut
.In the future, a quantile-based K-Bins discretizer should be added, as that is also commonly used. It is more complex to implement, though. For the time being, users can calculate the quantiles themselves and pass them to
CustomKBinsDiscretizer
.Related issue number
Closes #28301
Checks
git commit -s
) in this PR.scripts/format.sh
to lint the changes in this PR.