Skip to content

Commit 26896e9

Browse files
authored
1692 iterative graph not showing in docs (#3592)
* Shows two graphs, one empty one filled * Made it only print out one graph * Updated docstring * test to see if .show() makes tests slow * release notes update * testing to see if returning the figure works * Trying to make the parameter false. * show_iteration_plot is now default false * Added testing and removed redundant code * Added Becca's changes * Added check so that tests don't take hours * Edited some ipynb to reflect change * Documentation fixes * Deleted un-needed test
1 parent 426f2b3 commit 26896e9

File tree

8 files changed

+39
-28
lines changed

8 files changed

+39
-28
lines changed

docs/source/demos/cost_benefit_matrix.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124
"from evalml import AutoMLSearch\n",
125125
"automl = AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary', objective='log loss binary',\n",
126126
" max_iterations=5, verbose=True)\n",
127-
"automl.search()\n",
127+
"automl.search(interactive_plot=False)\n",
128128
"\n",
129129
"ll_pipeline = automl.best_pipeline\n",
130130
"ll_pipeline.score(X_holdout, y_holdout, ['log loss binary'])"
@@ -175,7 +175,7 @@
175175
"source": [
176176
"automl = AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary', objective=cost_benefit_matrix,\n",
177177
" max_iterations=5, verbose=True)\n",
178-
"automl.search()\n",
178+
"automl.search(interactive_plot=False)\n",
179179
"\n",
180180
"cbm_pipeline = automl.best_pipeline"
181181
]
@@ -274,4 +274,4 @@
274274
},
275275
"nbformat": 4,
276276
"nbformat_minor": 4
277-
}
277+
}

docs/source/demos/fraud.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@
115115
" optimize_thresholds=True,\n",
116116
" verbose=True)\n",
117117
"\n",
118-
"automl.search()"
118+
"automl.search(interactive_plot=False)"
119119
]
120120
},
121121
{
@@ -219,7 +219,7 @@
219219
" optimize_thresholds=True,\n",
220220
" verbose=True)\n",
221221
"\n",
222-
"automl_auc.search()"
222+
"automl_auc.search(interactive_plot=False)"
223223
]
224224
},
225225
{

docs/source/demos/lead_scoring.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@
150150
" max_batches=3,\n",
151151
" verbose=True)\n",
152152
"\n",
153-
"automl.search()"
153+
"automl.search(interactive_plot=False)"
154154
]
155155
},
156156
{
@@ -247,7 +247,7 @@
247247
" max_batches=3,\n",
248248
" verbose=True)\n",
249249
"\n",
250-
"automl_auc.search()"
250+
"automl_auc.search(interactive_plot=False)"
251251
]
252252
},
253253
{
@@ -329,4 +329,4 @@
329329
},
330330
"nbformat": 4,
331331
"nbformat_minor": 4
332-
}
332+
}

docs/source/demos/text_input.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
" optimize_thresholds=True,\n",
137137
" verbose=True)\n",
138138
"\n",
139-
"automl.search()"
139+
"automl.search(interactive_plot=False)"
140140
]
141141
},
142142
{
@@ -362,7 +362,7 @@
362362
" optimize_thresholds=True,\n",
363363
" verbose=True)\n",
364364
"\n",
365-
"automl_no_text.search()"
365+
"automl_no_text.search(interactive_plot=False)"
366366
]
367367
},
368368
{
@@ -455,4 +455,4 @@
455455
},
456456
"nbformat": 4,
457457
"nbformat_minor": 4
458-
}
458+
}

docs/source/release_notes.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ Release Notes
33
**Future Releases**
44
* Enhancements
55
* Fixes
6+
* Fixed iterative graphs not appearing in documentation :pr:`3592`
67
* Updated the `load_diabetes()` method to account for scikit-learn 1.1.1 changes to the dataset :pr:`3591`
78
* Changes
89
* Documentation Changes

docs/source/start.ipynb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,16 @@
133133
"metadata": {},
134134
"outputs": [],
135135
"source": [
136-
"automl.search()"
136+
"automl.search(interactive_plot=False)"
137137
]
138138
},
139139
{
140140
"cell_type": "markdown",
141141
"metadata": {},
142142
"source": [
143-
"If you would like to suppress stdout output, set `verbose=False`. This is also the default behavior for `AutoMLSearch` if `verbose` is not specified."
143+
"If you would like to suppress stdout output, set `verbose=False`. This is also the default behavior for `AutoMLSearch` if `verbose` is not specified. \n",
144+
"\n",
145+
"Also, if you would like to see the interactive plot update dynamically over time as the search progresses, either remove the parameter or set `interactive_plot=True`. This is the default setting for `search()` if `interactive_plot` is not specified (it is set to False here due to documentation workaround)."
144146
]
145147
},
146148
{
@@ -266,4 +268,4 @@
266268
},
267269
"nbformat": 4,
268270
"nbformat_minor": 4
269-
}
271+
}

docs/source/user_guide/automl.ipynb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@
136136
"outputs": [],
137137
"source": [
138138
"automl = evalml.automl.AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary', verbose=True)\n",
139-
"automl.search()"
139+
"automl.search(interactive_plot=False)"
140140
]
141141
},
142142
{
@@ -645,7 +645,7 @@
645645
" ensembling=True,\n",
646646
" automl_algorithm='iterative',\n",
647647
" verbose=True)\n",
648-
"automl_with_ensembling.search()"
648+
"automl_with_ensembling.search(interactive_plot=False)"
649649
]
650650
},
651651
{
@@ -716,7 +716,7 @@
716716
"source": [
717717
"from evalml import AutoMLSearch\n",
718718
"auto_iterative = AutoMLSearch(X_train=X, y_train=y, problem_type='binary', automl_algorithm='iterative', verbose=True)\n",
719-
"auto_iterative.search()"
719+
"auto_iterative.search(interactive_plot=False)"
720720
]
721721
},
722722
{
@@ -780,7 +780,7 @@
780780
"source": [
781781
"from evalml import AutoMLSearch\n",
782782
"auto_default = AutoMLSearch(X_train=X, y_train=y, problem_type='binary', automl_algorithm='default', ensembling=True, verbose=True)\n",
783-
"auto_default.search()"
783+
"auto_default.search(interactive_plot=False)"
784784
]
785785
},
786786
{
@@ -858,7 +858,7 @@
858858
" problem_type=\"binary\",\n",
859859
" allowed_model_families=[ModelFamily.LINEAR_MODEL],\n",
860860
" engine=\"cf_threaded\")\n",
861-
"automl_cf_threaded.search(show_iteration_plot = False)\n",
861+
"automl_cf_threaded.search(interactive_plot = False)\n",
862862
"automl_cf_threaded.close_engine()"
863863
]
864864
},
@@ -888,7 +888,7 @@
888888
" problem_type=\"binary\",\n",
889889
" allowed_model_families=[ModelFamily.LINEAR_MODEL],\n",
890890
" engine=cf_engine)\n",
891-
"automl_cf_threaded.search(show_iteration_plot = False)\n",
891+
"automl_cf_threaded.search(interactive_plot = False)\n",
892892
"automl_cf_threaded.close_engine()"
893893
]
894894
},
@@ -906,7 +906,7 @@
906906
"automl_cf_process = AutoMLSearch(X_train=X, y_train=y,\n",
907907
" problem_type=\"binary\",\n",
908908
" engine=\"cf_process\")\n",
909-
"automl_cf_process.search(show_iteration_plot = False)\n",
909+
"automl_cf_process.search(interactive_plot = False)\n",
910910
"automl_cf_process.close_engine()\n",
911911
"```"
912912
]
@@ -935,7 +935,7 @@
935935
" problem_type=\"binary\",\n",
936936
" allowed_model_families=[ModelFamily.LINEAR_MODEL],\n",
937937
" engine=dask_engine_p2)\n",
938-
"automl_dask_p2.search(show_iteration_plot = False)\n",
938+
"automl_dask_p2.search(interactive_plot = False)\n",
939939
"\n",
940940
"# Explicitly shutdown the automl object's LocalCluster\n",
941941
"automl_dask_p2.close_engine()"
@@ -953,7 +953,7 @@
953953
" problem_type=\"binary\",\n",
954954
" allowed_model_families=[ModelFamily.LINEAR_MODEL],\n",
955955
" engine=dask_engine_t4)\n",
956-
"automl_dask_t4.search(show_iteration_plot = False)\n",
956+
"automl_dask_t4.search(interactive_plot = False)\n",
957957
"automl_dask_t4.close_engine()"
958958
]
959959
},

evalml/automl/automl_search.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import numpy as np
1414
import pandas as pd
1515
from dask import distributed as dd
16+
from plotly import io as pio
1617
from sklearn.model_selection import BaseCrossValidator
1718
from skopt.space import Categorical
1819

@@ -857,11 +858,11 @@ def _handle_keyboard_interrupt(self):
857858
else:
858859
leading_char = ""
859860

860-
def search(self, show_iteration_plot=True):
861+
def search(self, interactive_plot=True):
861862
"""Find the best pipeline for the data set.
862863
863864
Args:
864-
show_iteration_plot (boolean, True): Shows an iteration vs. score plot in Jupyter notebook.
865+
interactive_plot (boolean, True): Shows an iteration vs. score plot in Jupyter notebook.
865866
Disabled by default in non-Jupyter enviroments.
866867
867868
Raises:
@@ -874,11 +875,11 @@ def search(self, show_iteration_plot=True):
874875
return
875876

876877
# don't show iteration plot outside of a jupyter notebook
877-
if show_iteration_plot:
878+
if interactive_plot:
878879
try:
879880
get_ipython
880881
except NameError:
881-
show_iteration_plot = False
882+
interactive_plot = False
882883

883884
log_title(self.logger, "Beginning pipeline search")
884885
self.logger.info("Optimizing for %s. " % self.objective.name)
@@ -909,7 +910,7 @@ def search(self, show_iteration_plot=True):
909910
self.search_iteration_plot = None
910911
if self.plot and self.verbose:
911912
self.search_iteration_plot = self.plot.search_iteration_plot(
912-
interactive_plot=show_iteration_plot
913+
interactive_plot=interactive_plot
913914
)
914915

915916
self._start = time.time()
@@ -1006,6 +1007,13 @@ def search(self, show_iteration_plot=True):
10061007
f"Best pipeline {self.objective.name}: {best_pipeline['validation_score']:3f}"
10071008
)
10081009
self._searched = True
1010+
if self.search_iteration_plot is not None:
1011+
if self.verbose and not interactive_plot:
1012+
self.search_iteration_plot = self.plot.search_iteration_plot(
1013+
interactive_plot=interactive_plot
1014+
)
1015+
if pio.renderers.default != "browser":
1016+
self.search_iteration_plot.show()
10091017

10101018
def _find_best_pipeline(self):
10111019
"""Finds the best pipeline in the rankings If self._best_pipeline already exists, check to make sure it is different from the current best pipeline before training and thresholding."""

0 commit comments

Comments
 (0)