Skip to content

DOC: fixup plot in "Pipelining: chaining a PCA and a logistic regression" example #28345

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

Conversation

MarcoGorelli
Copy link
Contributor

@MarcoGorelli MarcoGorelli commented Feb 1, 2024

Reference Issues/PRs

What does this implement/fix? Explain your changes.

The bottom axis of the current plot doesn't really look right, see https://scikit-learn.org/stable/auto_examples/compose/plot_digits_pipe.html

I'd suggest just using matplotlib directly

before:

image

after:

image

Any other comments?

This example actually might be a good example of using Polars in the docs (#28341), as then you could do something like this :

best_clfs = (
    pl.LazyFrame(cv_results_)
    .filter(
        (pl.col("mean_test_score") == pl.col("mean_test_score").max()).over(components_col)
    )
    .collect()
)

and avoid a lambda in the groupby, cc @adrinjalali

Copy link

github-actions bot commented Feb 1, 2024

✔️ Linting Passed

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

Generated for commit: 0a9ae0c. Link to the linter CI: here

@MarcoGorelli MarcoGorelli marked this pull request as ready for review February 1, 2024 17:30
Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

Yes, I think this is a very good place to start. I think even if for (memory) performance reasons we prefer pandas for now, it's good to do pre-scikit-learn and post-scikit-learn steps in polars. But the question is, should we (as scikit-learn) care about that. Tricky one.

Gonna merge this one anyway, thanks for the fix on the plot.

@adrinjalali adrinjalali enabled auto-merge (squash) February 1, 2024 17:56
@adrinjalali adrinjalali merged commit 700afd8 into scikit-learn:main Feb 1, 2024
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Feb 10, 2024
…ion" example (scikit-learn#28345)

Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Feb 13, 2024
…ion" example (scikit-learn#28345)

Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
glemaitre pushed a commit that referenced this pull request Feb 13, 2024
…ion" example (#28345)

Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
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.

2 participants