Skip to content

Commit 5103737

Browse files
authored
DOC fix examples in compose.rst due to change in code snippet order (scikit-learn#27425)
1 parent 0699f29 commit 5103737

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

doc/modules/compose.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,7 @@ To enable model inspection, :class:`~sklearn.pipeline.Pipeline` has a
128128
pipeline slicing to get the feature names going into each step::
129129

130130
>>> from sklearn.datasets import load_iris
131+
>>> from sklearn.linear_model import LogisticRegression
131132
>>> from sklearn.feature_selection import SelectKBest
132133
>>> iris = load_iris()
133134
>>> pipe = Pipeline(steps=[
@@ -160,6 +161,7 @@ is therefore nested because it belongs to a particular sub-step. Parameters of t
160161
estimators in the pipeline are accessible using the ``<estimator>__<parameter>``
161162
syntax::
162163

164+
>>> pipe = Pipeline(steps=[("reduce_dim", PCA()), ("clf", SVC())])
163165
>>> pipe.set_params(clf__C=10)
164166
Pipeline(steps=[('reduce_dim', PCA()), ('clf', SVC(C=10))])
165167

@@ -177,7 +179,6 @@ This is particularly important for doing grid searches::
177179
Individual steps may also be replaced as parameters, and non-final steps may be
178180
ignored by setting them to ``'passthrough'``::
179181

180-
>>> from sklearn.linear_model import LogisticRegression
181182
>>> param_grid = dict(reduce_dim=['passthrough', PCA(5), PCA(10)],
182183
... clf=[SVC(), LogisticRegression()],
183184
... clf__C=[0.1, 10, 100])

0 commit comments

Comments
 (0)