scikit-learn/scikit-learn

Fix notebook-style examples

GaelVaroquaux opened this issue · 47 comments

Describe the issue linked to the documentation

Many legitimate notebook style examples have been broken, and specifically by the following PR
#9061

List of examples to update

Note for maintainers: the content between begin/end_auto_generated is updated automatically by a script. If you edit it by hand your changes may be reverted. The script doing the update: https://gist.github.com/lesteve/478d52599d394ec5e7f56dbf0827a5e9

Here are all the examples that use patterns like # ####### (found by ag -l '# #####*\s#' examples | sort, note there may be false positives ... for I removed examples/impute/plot_missing_values.py which is using # %% but also # #### as title underlines ...):

begin_auto_generated

end_auto_generated

Suggest a potential alternative/fix

The examples need to be reviewed on a case by case, to know whether they are "notebook-syle", as in https://sphinx-gallery.github.io/stable/tutorials/plot_parse.html#sphx-glr-tutorials-plot-parse-py or not. In general, we should favor notebook-style examples, which are typically more readable.

We should probably favor the "# %%" syntax to the long line of "###"
https://sphinx-gallery.github.io/stable/syntax.html#embed-rst-in-your-example-python-files

In terms of reviewing workflow, it can be useful to to send different PRs, rather than a big PR which will be harder to review.

Pieces of advice if you are interested in working on this issue

Working on this

I have added a list of examples that uses a pattern like # ##### for comments. I think it is best to create one PR by example, this will make it easier to review changes.

@GaelVaroquaux Do you mean that we wish to standardize (# %% (preferred), or # ##) the block splitter across all relevant scripts?

@GaelVaroquaux Make sense! How would you recommend that I help with this?

@ss-is-master-chief I have added a "Pieces of advice if you are interested in working on this issue" section in the top post to help you (and potentially other interested people to get started). If something is not clear let us know!

I want to help.

working on examples/svm/plot_svm_regression.py

working on examples/svm/plot_svm_anova.py

Working on examples/linear_model/plot_ols_3d.py

Working on examples/cluster/plot_mean_shift.py

Working on examples/svm/plot_rbf_parameters.py

working on examples/semi_supervised/plot_label_propagation_digits.py and examples/semi_supervised/plot_label_propagation_structure.py

Working on linear_model/plot_lasso_dense_vs_sparse_data.py

Starting to work on examples/miscellaneous/plot_kernel_ridge_regression.py

cdrig commented

Starting to work on examples/model_selection/plot_roc_crossval.py

Working on examples/cluster/plot_coin_ward_segmentation.py