8000 MAINT Fix full doc build by avoiding plot_set_output.py side-effect by lesteve · Pull Request #24654 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content

MAINT Fix full doc build by avoiding plot_set_output.py side-effect #24654

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 2 commits into from
Oct 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions examples/miscellaneous/plot_set_output.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,8 @@
log_reg = clf[-1]
coef = pd.Series(log_reg.coef_.ravel(), index=log_reg.feature_names_in_)
_ = coef.sort_values().plot.barh()

# %%
# This resets `transform_output` to its default value to avoid impacting other
# examples when generating the scikit-learn documentation
set_config(transform_output="default")
Copy link
Member

Choose a reason for hiding this comment

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

This is surprising to me. I thought the examples run in separate processes.

Copy link
Member Author

Choose a reason for hiding this comment

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

As far as I know this is not the case: there is an exec somewhere that runs all the code from all the examples in the same interpreter. For example this is why sphinx-gallery has some reset functionality to clean-up before each example (e.g. closing all matplotlib figures): https://sphinx-gallery.github.io/stable/advanced.html#resetting-before-each-example

0