@@ -128,6 +128,7 @@ To enable model inspection, :class:`~sklearn.pipeline.Pipeline` has a
128
128
pipeline slicing to get the feature names going into each step::
129
129
130
130
>>> from sklearn.datasets import load_iris
131
+ >>> from sklearn.linear_model import LogisticRegression
131
132
>>> from sklearn.feature_selection import SelectKBest
132
133
>>> iris = load_iris()
133
134
>>> pipe = Pipeline(steps=[
@@ -160,6 +161,7 @@ is therefore nested because it belongs to a particular sub-step. Parameters of t
160
161
estimators in the pipeline are accessible using the ``<estimator>__<parameter> ``
161
162
syntax::
162
163
164
+ >>> pipe = Pipeline(steps=[("reduce_dim", PCA()), ("clf", SVC())])
163
165
>>> pipe.set_params(clf__C=10)
164
166
Pipeline(steps=[('reduce_dim', PCA()), ('clf', SVC(C=10))])
165
167
@@ -177,7 +179,6 @@ This is particularly important for doing grid searches::
177
179
Individual steps may also be replaced as parameters, and non-final steps may be
178
180
ignored by setting them to ``'passthrough' ``::
179
181
180
- >>> from sklearn.linear_model import LogisticRegression
181
182
>>> param_grid = dict(reduce_dim=['passthrough', PCA(5), PCA(10)],
182
183
... clf=[SVC(), LogisticRegression()],
183
184
... clf__C=[0.1, 10, 100])
0 commit comments