Thanks to visit codestin.com
Credit goes to github.com

Skip to content

FIX warning using polars DataFrames in DecisionBoundaryDisplay.from_estimator #28718

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

Merged
merged 12 commits into from
Apr 10, 2024

Conversation

patrickkwang
Copy link
Contributor

Reference Issues/PRs

Fixes #28717, which is analogous to #23311, but for polars.

See also #25896.

What does this implement/fix? Explain your changes.

This fix is analogous to #23318. We identify when the predictors passed to DecisionBoundaryPlot.from_estimator is a polars DataFrame and refrain from converting it to a numpy array and stripping the column names.

Any other comments?

The way we do this is a bit awkward because we want to avoid importing polars. A nicer way to do this would be something like the following:

X_grid = pl.DataFrame({
    column: series
    for column, series in zip(X.columns, (xx0.ravel(), xx1.ravel()))
})

... but that would require import polars as pl.

Instead we drop the existing columns and add columns with the same names and the data from meshgrid.

Copy link

github-actions bot commented Mar 28, 2024

✔️ Linting Passed

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

Generated for commit: b66a38d. Link to the linter CI: here

@patrickkwang patrickkwang force-pushed the decisionboundaryplot-polars branch from bcbc83a to b5c5044 Compare March 28, 2024 13:23
@patrickkwang patrickkwang force-pushed the decisionboundaryplot-polars branch from b5c5044 to e729040 Compare March 28, 2024 13:26
Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @patrickkwang. ping @glemaitre who made the fix for pandas dataframes for another review.

Copy link
Member

@jeremiedbb jeremiedbb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add an entry in the v1.4.rst change log. Otherwise LGTM. Thanks @patrickkwang.

@jeremiedbb jeremiedbb added this to the 1.4.2 milestone Apr 3, 2024
@patrickkwang
Copy link
Contributor Author

Please add an entry in the v1.4.rst change log. Otherwise LGTM. Thanks @patrickkwang.

Done.

@patrickkwang patrickkwang force-pushed the decisionboundaryplot-polars branch from 2306fb0 to 3593d79 Compare April 4, 2024 21:38
@jeremiedbb jeremiedbb modified the milestones: 1.4.2, 1.5 Apr 5, 2024
@jeremiedbb
Copy link
Member

We've decided that the 1.4.2 release will only be about numpy 2 support, so I moved the changelog entry into v1.5.rst, which is expected in a month. Sorry for the misleading request.

@glemaitre glemaitre self-requested a review April 9, 2024 15:16
Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise LGTM.

@glemaitre glemaitre changed the title Fix warning using polars DataFrames in DecisionBoundaryDisplay.from_estimator FIX warning using polars DataFrames in DecisionBoundaryDisplay.from_estimator Apr 9, 2024
@jeremiedbb
Copy link
Member

Thanks @patrickkwang

@jeremiedbb jeremiedbb merged commit 3fa732b into scikit-learn:main Apr 10, 2024
30 checks passed
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.

Warning with DecisionBoundaryPlot and polars DataFrame
4 participants