Skip to content

Commit

Permalink
Simplify logging behavior (#2645)
Browse files Browse the repository at this point in the history
* Remove file writing part of get_logger

* Replace all calls to get_logger with logging.getLogger

* Add verbose flag to AutoMLSearch

* Allow for verbose=False after verbose=True

* Include plotting suppression when verbose=False

* Update log_error_callback to use error/warning instead of info/debug
  • Loading branch information
eccabay committed Sep 9, 2021
1 parent 4dffcfa commit adb844b
Show file tree
Hide file tree
Showing 27 changed files with 242 additions and 319 deletions.
6 changes: 3 additions & 3 deletions docs/source/demos/cost_benefit_matrix.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"source": [
"from evalml import AutoMLSearch\n",
"automl = AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary', objective='log loss binary',\n",
" max_iterations=5)\n",
" max_iterations=5, verbose=True)\n",
"automl.search()\n",
"\n",
"ll_pipeline = automl.best_pipeline\n",
Expand Down Expand Up @@ -174,7 +174,7 @@
"outputs": [],
"source": [
"automl = AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary', objective=cost_benefit_matrix,\n",
" max_iterations=5)\n",
" max_iterations=5, verbose=True)\n",
"automl.search()\n",
"\n",
"cbm_pipeline = automl.best_pipeline"
Expand Down Expand Up @@ -274,4 +274,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
8 changes: 5 additions & 3 deletions docs/source/demos/fraud.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,8 @@
" additional_objectives=['auc', 'f1', 'precision'],\n",
" allowed_model_families=[\"random_forest\", \"linear_model\"],\n",
" max_batches=1,\n",
" optimize_thresholds=True)\n",
" optimize_thresholds=True,\n",
" verbose=True)\n",
"\n",
"automl.search()"
]
Expand Down Expand Up @@ -215,7 +216,8 @@
" additional_objectives=['f1', 'precision'],\n",
" max_batches=1,\n",
" allowed_model_families=[\"random_forest\", \"linear_model\"],\n",
" optimize_thresholds=True)\n",
" optimize_thresholds=True,\n",
" verbose=True)\n",
"\n",
"automl_auc.search()"
]
Expand Down Expand Up @@ -298,4 +300,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
8 changes: 5 additions & 3 deletions docs/source/demos/lead_scoring.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,8 @@
" objective=lead_scoring_objective,\n",
" additional_objectives=['auc'],\n",
" allowed_model_families=[\"catboost\", \"random_forest\", \"linear_model\"],\n",
" max_batches=1)\n",
" max_batches=1,\n",
" verbose=True)\n",
"\n",
"automl.search()"
]
Expand Down Expand Up @@ -243,7 +244,8 @@
" objective='auc',\n",
" additional_objectives=[lead_scoring_objective],\n",
" allowed_model_families=[\"catboost\", \"random_forest\", \"linear_model\"],\n",
" max_batches=1)\n",
" max_batches=1,\n",
" verbose=True)\n",
"\n",
"automl_auc.search()"
]
Expand Down Expand Up @@ -327,4 +329,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
6 changes: 4 additions & 2 deletions docs/source/demos/text_input.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,8 @@
"automl = AutoMLSearch(X_train=X_train, y_train=y_train,\n",
" problem_type='binary',\n",
" max_batches=1,\n",
" optimize_thresholds=True)\n",
" optimize_thresholds=True,\n",
" verbose=True)\n",
"\n",
"automl.search()"
]
Expand Down Expand Up @@ -354,7 +355,8 @@
"automl_no_text = AutoMLSearch(X_train=X_train, y_train=y_train,\n",
" problem_type='binary',\n",
" max_batches=1,\n",
" optimize_thresholds=True)\n",
" optimize_thresholds=True,\n",
" verbose=True)\n",
"\n",
"automl_no_text.search()"
]
Expand Down
3 changes: 3 additions & 0 deletions docs/source/release_notes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ Release Notes
-------------
**Future Releases**
* Enhancements
* Added ``verbose`` flag to ``AutoMLSearch`` to run search in silent mode by default :pr:`2645`
* Added label encoder to ``XGBoostClassifier`` to remove the warning :pr:`2701`
* Set ``eval_metric`` to ``logloss`` for ``XGBoostClassifier`` :pr:`2741`
* Added support for ``woodwork`` versions ``0.7.0`` and ``0.7.1`` :pr:`2743`
* Fixes
* Fixed bug where ``Imputer.transform`` would erase ww typing information prior to handing data to the ``SimpleImputer`` :pr:`2752`
* Fixed bug where ``Oversampler`` could not be copied :pr:`2755`
* Changes
* Removed default logging setup and debugging log file :pr:`2645`
* Documentation Changes
* Specified installation steps for Prophet :pr:`2713`
* Added documentation for data exploration on data check actions :pr:`2696`
Expand All @@ -18,6 +20,7 @@ Release Notes
.. warning::

**Breaking Changes**
* Removed default logging setup and debugging log file :pr:`2645`

**v0.32.0 Aug. 31, 2021**
* Enhancements
Expand Down
24 changes: 22 additions & 2 deletions docs/source/start.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@
"outputs": [],
"source": [
"automl = AutoMLSearch(X_train=X_train, y_train=y_train,\n",
" problem_type='binary', objective='f1', max_batches=1)"
" problem_type='binary', objective='f1', \n",
" max_batches=1, verbose=True)"
]
},
{
Expand All @@ -135,6 +136,25 @@
"automl.search()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you would like to suppress stdout output, set `verbose=False`. This is also the default behavior for `AutoMLSearch` if `verbose` is not specified."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"automl = AutoMLSearch(X_train=X_train, y_train=y_train,\n",
" problem_type='binary', objective='f1', \n",
" max_batches=1, verbose=False)\n",
"automl.search()"
]
},
{
"cell_type": "markdown",
"metadata": {},
Expand Down Expand Up @@ -246,4 +266,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
31 changes: 18 additions & 13 deletions docs/source/user_guide/automl.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"\n",
"In its simplest usage, the AutoML search interface requires only the input data, the target data and a `problem_type` specifying what kind of supervised ML problem to model.\n",
"\n",
"** Graphing methods, like AutoMLSearch, on Jupyter Notebook and Jupyter Lab require [ipywidgets](https://ipywidgets.readthedocs.io/en/latest/user_install.html) to be installed.\n",
"** Graphing methods, like verbose AutoMLSearch, on Jupyter Notebook and Jupyter Lab require [ipywidgets](https://ipywidgets.readthedocs.io/en/latest/user_install.html) to be installed.\n",
"\n",
"** If graphing on Jupyter Lab, [jupyterlab-plotly](https://plotly.com/python/getting-started/#jupyterlab-support-python-35) required. To download this, make sure you have [npm](https://nodejs.org/en/download/) installed."
]
Expand Down Expand Up @@ -135,15 +135,15 @@
"metadata": {},
"outputs": [],
"source": [
"automl = evalml.automl.AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary')\n",
"automl = evalml.automl.AutoMLSearch(X_train=X_train, y_train=y_train, problem_type='binary', verbose=True)\n",
"automl.search()"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"The AutoML search will log its progress, reporting each pipeline and parameter set evaluated during the search.\n",
"With the `verbose` argument set to True, the AutoML search will log its progress, reporting each pipeline and parameter set evaluated during the search.\n",
"\n",
"There are a number of mechanisms to control the AutoML search time. One way is to set the `max_batches` parameter which controls the maximum number of rounds of AutoML to evaluate, where each round may train and score a variable number of pipelines. Another way is to set the `max_iterations` parameter which controls the maximum number of candidate models to be evaluated during AutoML. By default, AutoML will search for a single batch. The first pipeline to be evaluated will always be a baseline model representing a trivial solution. "
]
Expand Down Expand Up @@ -234,11 +234,13 @@
"from evalml.pipelines import MulticlassClassificationPipeline\n",
"\n",
"\n",
"automl_custom = evalml.automl.AutoMLSearch(X_train=X_train,\n",
" y_train=y_train,\n",
" problem_type='multiclass',\n",
" allowed_component_graphs={\"My_pipeline\": ['Simple Imputer', 'Random Forest Classifier'],\n",
" \"My_other_pipeline\": ['One Hot Encoder', 'Random Forest Classifier']})"
"automl_custom = evalml.automl.AutoMLSearch(\n",
" X_train=X_train,\n",
" y_train=y_train,\n",
" problem_type='multiclass',\n",
" verbose=True,\n",
" allowed_component_graphs={\"My_pipeline\": ['Simple Imputer', 'Random Forest Classifier'],\n",
" \"My_other_pipeline\": ['One Hot Encoder', 'Random Forest Classifier']})"
]
},
{
Expand Down Expand Up @@ -515,8 +517,10 @@
"# using this custom hyperparameter means that our Imputer components in these pipelines will only search through\n",
"# 'median' and 'most_frequent' strategies for 'numeric_impute_strategy', and the initial batch parameter will be\n",
"# set to 'median'\n",
"automl_constrained = AutoMLSearch(X_train=X, y_train=y, problem_type='binary', pipeline_parameters=pipeline_parameters,\n",
" custom_hyperparameters=custom_hyperparameters)"
"automl_constrained = AutoMLSearch(X_train=X, y_train=y, problem_type='binary', \n",
" pipeline_parameters=pipeline_parameters,\n",
" custom_hyperparameters=custom_hyperparameters, \n",
" verbose=True)"
]
},
{
Expand Down Expand Up @@ -616,7 +620,8 @@
" problem_type=\"binary\",\n",
" allowed_model_families=[ModelFamily.LINEAR_MODEL],\n",
" max_batches=4,\n",
" ensembling=True)\n",
" ensembling=True,\n",
" verbose=True)\n",
"automl_with_ensembling.search()"
]
},
Expand Down Expand Up @@ -803,7 +808,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -822,4 +827,4 @@
},
"nbformat": 4,
"nbformat_minor": 4
}
}
4 changes: 2 additions & 2 deletions docs/source/user_guide/utilities.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
"source": [
"## Configuring Logging\n",
"\n",
"EvalML uses [the standard python logging package](https://docs.python.org/3/library/logging.html). By default, EvalML will log `INFO`-level logs and higher (warnings, errors and critical) to stdout, and will log everything to `evalml_debug.log` in the current working directory.\n",
"EvalML uses [the standard Python logging package](https://docs.python.org/3/library/logging.html). Default logging behavior prints WARNING level logs and above (ERROR and CRITICAL) to stdout. To configure different behavior, please refer to the Python logging documentation.\n",
"\n",
"If you want to change the location of the logfile, before import, set the `EVALML_LOG_FILE` environment variable to specify a filename within an existing directory in which you have write permission. If you want to disable logging to the logfile, set `EVALML_LOG_FILE` to be empty. If the environment variable is set to an invalid location, EvalML will print a warning message to stdout and will not create a log file."
"To see up-to-date feedback as `AutoMLSearch` runs, use the argument `verbose=True` when instantiating the object. This will temporarily set up a logging object to print INFO level logs and above to stdout, as well as display a graph of the best score over pipeline iterations."
]
},
{
Expand Down
Loading

0 comments on commit adb844b

Please sign in to comment.