Skip to content
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

DOC modify plot_scalable_poly_kernels.py format #23009

Merged
merged 15 commits into from
Apr 8, 2022

Conversation

jsilke
Copy link
Contributor

@jsilke jsilke commented Mar 31, 2022

Reference Issues/PRs

#22903

What does this implement/fix? Explain your changes.

Modifies plot_scalable_poly_kernels.py pursuant to the discussion in #22903:

  • imports are moved to the cells in which they are first used
  • add section headings

Any other comments?

time could also be swapped out for perf_counter, but I don't think it's necessary here.

Copy link
Member

@ArturoAmorQ ArturoAmorQ left a comment

Choose a reason for hiding this comment

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

Just some small comments but otherwise LGTM!

@@ -98,6 +114,9 @@
# (`n_runs` = 1) in this example, in practice one should repeat the experiment several
# times to compensate for the stochastic nature of :class:`PolynomialCountSketch`.

from sklearn.pipeline import Pipeline
Copy link
Member

Choose a reason for hiding this comment

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

Can we also use make_pipeline here and save some lines?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a good point! I have replaced the use of Pipeline with make_pipeline, as you suggest.

Copy link
Member

Choose a reason for hiding this comment

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

You are still using Pipeline, maybe you have not pushed your commit?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, my mistake. Thank you for letting me know! The change should be reflected correctly now.

# Finally, plot the results of the different methods against their training
# times. As we can see, the kernelized SVM achieves a higher accuracy,
# but its training time is much larger and, most importantly, will grow
# much faster if the number of training samples increases.

import matplotlib.pyplot as plt

Copy link
Member

Choose a reason for hiding this comment

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

Maybe we can add a title to the plot below. Something similar to "Accuracy vs training time trade-off", what do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I am not the biggest fan of plot titles (generally) because I find the information they add is often redundant and they tend to harm the data-ink ratio. Perhaps a caption could be added to briefly summarize the figure, but I don't believe it's strictly necessary here.

If there is some merit to adding a title that I have overlooked, or if you think adding a caption would improve the figure, I am open to making a revision here.

Copy link
Member

Choose a reason for hiding this comment

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

I don't have a strong opinion about adding a title, as I agree the information is already there. Thanks @jsilke!

@lesteve
Copy link
Member

lesteve commented Apr 8, 2022

Thanks the rendered artifacts look good, merging!

Thanks also @ArturoAmorQ for the review!

@lesteve lesteve merged commit 5a23a85 into scikit-learn:main Apr 8, 2022
@jsilke jsilke deleted the format_plot_scalable_poly_kernels branch April 8, 2022 16:33
jjerphan pushed a commit to jjerphan/scikit-learn that referenced this pull request Apr 29, 2022
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@gmail.com>
mathijs02 pushed a commit to mathijs02/scikit-learn that referenced this pull request Dec 27, 2022
Co-authored-by: Guillaume Lemaitre <g.lemaitre58@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.

None yet

3 participants