Skip to content

Fix #13194: Ensure monotonic bin edges for KBinsDiscretizer strategy quantile #13195

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

Closed
wants to merge 1 commit into from
Closed

Fix #13194: Ensure monotonic bin edges for KBinsDiscretizer strategy quantile #13195

wants to merge 1 commit into from

Conversation

SandroCasagrande
Copy link
Contributor

Reference Issues/PRs

Fixes #13194

What does this implement/fix? Explain your changes.

The percentiles returned from np.percentile are monotonic up to possible numeric instabilities. Monotonicity is enforced by applying a simple maximum on subsequent values to deal with this case and increase robustness.

Any other comments?

The additional line is a no-op in almost all cases. This is unfortunate, but since there is essentially no performance impact, I guess robustness is worth the effort.

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.

KBinsDiscretizer: quantile strategy fails due to unsorted bin_edges
1 participant