-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
display='diagram' needs more prominence in documentation #18305
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
Comments
So you need examples along with that guide page so that it shows more prominence such as diagrams and all? |
Hey @jnothman can you please help me with open source contributions to projects pertaining to machine learning. I have worked on research projects though I have never contributed here. Also all the issues seem so overwhelming I can't decide where to begin with. It would be wonderful if you could guide me through. Thanks 😁✨ |
@thomasjpfan What is the best place to put an example of the pipeline diagram call? b) Release highlights c) some other file? |
I'm not sure the right way to go is to introduce diagram rendering in the UG at random places. In most cases this will distract from the original purpose of the code snippets. I would prefer to have a dedicated example for illustrating the diagrams of different estimator, as Joel proposed above. Note that we already have https://scikit-learn.org/dev/auto_examples/compose/plot_column_transformer_mixed_types.html#html-representation-of-pipeline . Maybe we can add the keyword "Diagram" to this subsection for SEO. We can also add a small and short note at the end of this section of the getting started guide: https://scikit-learn.org/dev/getting_started.html |
Or a section (in Getting Started or otherwise) on how to configure Scikit-learn for a Jupyter Notebook. |
How about,
Pipelines: displaying diagrams in Jupyter notebook
---------------------------------------------------
The default configuration for displaying a pipeline is 'text': `set_config(display='text')`. To visualize the diagram in Jupyter Notebook, use `set_config(display='diagram')` and then call the pipeline object.
>>>from sklearn.pipeline import Pipeline
>>>from sklearn.svm import SVC
>>>from sklearn.decomposition import PCA
>>>estimators = [('reduce_dim', PCA()), ('clf', SVC())]
>>>pipe = Pipeline(estimators)
>>>pipe
Pipeline(steps=[('reduce_dim', PCA()), ('clf', SVC())])
>>>from sklearn import set_config
>>>set_config(display='diagram')
>>>pipe
|
OK for 1 For 2: I would rather not make a new section in the getting started guide. I think a note would be enough and to keep it short, we can just re-use the already defined pipeline in the corresponding section, and use the |
In getting_started.rst, can make the following edit, at the end of the section "Pipelines: chaining pre-processors and estimators", can add:
|
I think users would benefit from seeing the diagram in action:
This would ideally be withing a |
I didn't realize that the code in the UG is not executed by sphinx, and thus we can't see diagrams in the UG. It seems that we should create a dedicated example then, with various pipelines / estimators of different complexity. Would you be interested in doing that @reshamas ? @hongshaoyang also showed interest Some examples of estimators worth rendering (feel free to deviate):
|
@NicolasHug
|
I think we can just put it in |
You mean we need a few examples, but in one file called |
yes, though the file name needs to be named By example I mean one entry in https://scikit-learn.org/stable/auto_examples/index.html. Each of these are 1 file. In the example, we can illustrate more than one estimator (all of them, actually) |
I think we might also explicitly have "Tip(s) for scikit-learn in jupyter"
to mention this.
|
where? should this just be the example? I'm not sure we have enough material about scikit-learn in jupyter to have a whole new UG chapter |
I don't really know. In a tutorial?
|
@NicolasHug @jnothman |
@NicolasHug @cmarmo @jnothman Is this something we could consider doing for scikit-learn? It seems a bit more flexible. |
@reshamas why not create a regular example as suggested in #18305 (comment)? The examples from the gallery can be downloaded as |
@NicolasHug I recall the problem with creating a regular example was that sphinx did not produce the diagram in the documentation. But, in a Jupyter notebook, the diagram is produced. That way, users can see the code with the diagram. |
The examples are able to generate the html disaply properly, if that's what you mean: https://scikit-learn.org/stable/auto_examples/compose/plot_column_transformer_mixed_types.html#sphx-glr-auto-examples-compose-plot-column-transformer-mixed-types-py The issue with the html renderring and sphinx, IIRC, was only in the UG because the code isn't executed there |
@cmarmo |
The
sklearn.set_config(display='diagram')
feature highlighted here needs more prominence. At least, it should be easy to find it when googlingscikit-learn diagram display
. It isn't.scikit-learn display=diagram
is much the same, andscikit-learn "display=diagram"
is on the mark but the results are not easy to parse as being relevant.We probably need an example, or a user guide page, showing how different estimators are diagrammed, and perhaps also instructing users to use IPython.display's
display
function when needed.The text was updated successfully, but these errors were encountered: