Note
Go to the end to download the full example code. or to run this example in your browser via JupyterLite or Binder
Displaying Pipelines#
The default configuration for displaying a pipeline in a Jupyter Notebook is
'diagram'
where set_config(display='diagram')
. To deactivate HTML representation,
use set_config(display='text')
.
To see more detailed steps in the visualization of the pipeline, click on the steps in the pipeline.
# Authors: The scikit-learn developers # SPDX-License-Identifier: BSD-3-Clause
Displaying a Pipeline with a Preprocessing Step and Classifier#
This section constructs a Pipeline
with a preprocessing
step, StandardScaler
, and classifier,
LogisticRegression
, and displays its visual
representation.
fromsklearnimport set_config fromsklearn.linear_modelimport LogisticRegression fromsklearn.pipelineimport Pipeline fromsklearn.preprocessingimport StandardScaler steps = [ ("preprocessing", StandardScaler ()), ("classifier", LogisticRegression ()), ] pipe = Pipeline (steps)
To visualize the diagram, the default is display='diagram'
.
set_config (display="diagram") pipe # click on the diagram below to see the details of each step
Pipeline(steps=[('preprocessing', StandardScaler()), ('classifier', LogisticRegression())])In a Jupyter environment, please rerun this cell to show the HTML representation or trust the notebook.
On GitHub, the HTML representation is unable to render, please try loading this page with nbviewer.org.