1692 iterative graph not showing in docs#3592
Conversation
Codecov Report
@@ Coverage Diff @@
## main #3592 +/- ##
=======================================
+ Coverage 99.7% 99.7% +0.1%
=======================================
Files 335 335
Lines 33381 33387 +6
=======================================
+ Hits 33252 33258 +6
Misses 129 129
Continue to review full report at Codecov.
|
eccabay
left a comment
There was a problem hiding this comment.
Ok, I fell down into a rabbit hole of iteration plots while reviewing this, and I don't actually think this is a much of a band-aid solution as I originally thought. I left a comment about renaming the show_iteration_plot argument, and I think if we do the refactoring I mentioned there this will actually make a lot of sense.
Also, I don't think we should change the default behavior. It makes it easier to run the docs, but harder on our users to get that interactive plot. I would rather we update the docs to set show_iteration_plot (interactive_plot after renaming) to be False and add a note there mentioning this is a documentation workaround and you'll see an interactive plot by default.
| self.search_iteration_plot = self.plot.search_iteration_plot( | ||
| interactive_plot=show_iteration_plot | ||
| ) | ||
| return self.search_iteration_plot |
There was a problem hiding this comment.
Do we need to return this? Does it not render in the docs without it?
There was a problem hiding this comment.
From what I remember, without returning the self.search_iteration_plot, the docs don't render.
I could use figure.show() but that causes tests to take a really long time. (https://github.com/alteryx/evalml/runs/7100924419?check_suite_focus=true)
TL;DR: the automl tests was taking over an hour when it usually takes like 20-25 minutes when I used figure.show(). When I ran the test locally, figure.show() caused every test from automl to open a web browser tab and show me the graph, multiple times (before I stopped it manually safari had like 30+ tabs of just graphs). I suspect that's the reason why it takes so long (for whatever reason).
I tried to mess around with figure.show() parameters, but couldn't figure out a way to render the graph so that:
- It's interactive (and not like a jpg or png of the graph)
- It doesn't make the local test open up a browser every time it runs
automl.search() - Do both of the above and actually render when I build the doc using sphinx (sometimes it loads locally, then I check and it gives an error message when I upload it to github).
Of course there's a high chance I'm missing something pretty obvious (maybe I could try making it so that if figure.show() tries to use your web-browser to render it, then it doesn't?).
| if not show_iteration_plot: | ||
| self.search_iteration_plot = self.plot.search_iteration_plot( | ||
| interactive_plot=show_iteration_plot | ||
| ) |
There was a problem hiding this comment.
I had a really hard time understanding what this does. After falling down an iteration_plot rabbit hole, I think we should rename the show_iteration_plot argument to interactive_plot, to match the arg that's passed into search_iteration_plot.
In my mind, that's how this logic makes sense. If interactive_plot is True, we call self.plot.search_iteration_plot up around line 910, which will create the interactive plot as we know and love. If interactive_plot is False and verbose is True (the other scenario where we'd want a plot), we run this code at the end to generate that final post-search plot that the docs require.
Could you refactor this section and the section around line 910 to follow that logic? It'd keep things much simpler and easier to follow.
There was a problem hiding this comment.
To be a little clearer here, I think this section could look like
if self.verbose and not interactive_plot:
self.search_iteration_plot = self.plot.search_iteration_plot(interactive_plot=interactive_plot)
| # go = import_or_raise( | ||
| # "plotly.graph_objects", | ||
| # error_msg="Cannot find dependency plotly.graph_objects", | ||
| # ) | ||
| # title = "Pipeline Search: Iteration vs. {}<br><sub>Gray marker indicates the score at current iteration</sub>".format( | ||
| # self.objective.name | ||
| # ) | ||
| # layout = { | ||
| # "title": title, | ||
| # "xaxis": {"title": "Iteration", "rangemode": "tozero"}, | ||
| # "yaxis": {"title": "Score"}, | ||
| # } |
There was a problem hiding this comment.
We don't need commented out code!
chukarsten
left a comment
There was a problem hiding this comment.
I think Becca's left some good comments for addressing. Please keep an eye out for commiting a commented code. We find that a good way to prevent this is, while your PR is in draft status, doing a PR review on yourself and look over the diff. Review your PR as if you were an approver before changing status to ready!
…/alteryx/evalml into 1692-Iterative-Graph-Not-Showing
| }, | ||
| "vscode": { | ||
| "interpreter": { | ||
| "hash": "425958b484b95e5a5ab632cc76b33302e47efa72ef6819296d6f51644ebb328b" |
There was a problem hiding this comment.
I don't recall adding any of this, I wonder where it came from?
There was a problem hiding this comment.
did you open the notebook using vscode? Not sure if make lint-fix covers this part of the notebook but you could always manually remove it by opening the notebook in a text editor.
There was a problem hiding this comment.
I did open the notebook using vscode. I'll remove these from now on.
| self.search_iteration_plot = self.plot.search_iteration_plot( | ||
| interactive_plot=interactive_plot | ||
| ) | ||
| if pio.renderers.default != "browser": |
There was a problem hiding this comment.
This stops the automl tests from mass opening graphs in the browser, which was causing the tests to be really slow.
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "Python 3", | ||
| "display_name": "Python 3 (ipykernel)", |
There was a problem hiding this comment.
Not sure where these metadata changes are coming from.
There was a problem hiding this comment.
I have the same issue - if anyone has a way to fix this let me know, my current solution is to edit the file here in GitHub to remove these (same with the vscode hash down below).
eccabay
left a comment
There was a problem hiding this comment.
Looks good, thanks for making these changes!
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "Python 3", | ||
| "display_name": "Python 3 (ipykernel)", |
There was a problem hiding this comment.
I have the same issue - if anyone has a way to fix this let me know, my current solution is to edit the file here in GitHub to remove these (same with the vscode hash down below).
| "metadata": { | ||
| "kernelspec": { | ||
| "display_name": "Python 3", | ||
| "display_name": "Python 3.8.13 ('test123')", |
| ) | ||
| if pio.renderers.default != "browser": | ||
| self.search_iteration_plot.show() | ||
| # return self.search_iteration_plot |
There was a problem hiding this comment.
This comment should be removed!
There was a problem hiding this comment.
Aghhhh, I somehow missed that.
|
|
||
| Returns: | ||
| A plotly figure of the completed search |
There was a problem hiding this comment.
With using the browser check instead, we no longer need to have this in the docstring!
chukarsten
left a comment
There was a problem hiding this comment.
Looks good, thanks Michael!
Pull Request Description
Fixes the iterative graph not showing up in docs. This is a placeholder fix because the docs do not actually load the dynamic iterative graph, so what this pr does is, after searching, it graphs all the points and displays that.
I changed all the docs that search to not show the iterative graph since it will have just shown the user empty graphs.
Closes #1692
After creating the pull request: in order to pass the release_notes_updated check you will need to update the "Future Release" section of
docs/source/release_notes.rstto include this pull request by adding :pr:123.