@@ -131,10 +131,11 @@ class Pipeline(_BaseComposition):
131
131
>>> pipe = Pipeline([('scaler', StandardScaler()), ('svc', SVC())])
132
132
>>> # The pipeline can be used as any other estimator
133
133
>>> # and avoids leaking the test set into the train set
134
- >>> pipe.fit(X_train, y_train)
135
- Pipeline(steps=[('scaler', StandardScaler()), ('svc', SVC())])
136
- >>> pipe.score(X_test, y_test)
134
+ >>> pipe.fit(X_train, y_train).score(X_test, y_test)
137
135
0.88
136
+ >>> # An estimator's parameter can be set using '__' syntax
137
+ >>> pipe.set_params(svc__C=10).fit(X_train, y_train).score(X_test, y_test)
138
+ 0.76
138
139
"""
139
140
140
141
# BaseEstimator interface
@@ -1051,6 +1052,10 @@ class FeatureUnion(TransformerMixin, _BaseComposition):
1051
1052
>>> union.fit_transform(X)
1052
1053
array([[ 1.5 , 3.0..., 0.8...],
1053
1054
[-1.5 , 5.7..., -0.4...]])
1055
+ >>> # An estimator's parameter can be set using '__' syntax
1056
+ >>> union.set_params(pca__n_components=1).fit_transform(X)
1057
+ array([[ 1.5 , 3.0...],
1058
+ [-1.5 , 5.7...]])
1054
1059
"""
1055
1060
1056
1061
_required_parameters = ["transformer_list" ]
@@ -1362,11 +1367,12 @@ def __getitem__(self, name):
1362
1367
1363
1368
1364
1369
def make_union (* transformers , n_jobs = None , verbose = False ):
1365
- """Construct a FeatureUnion from the given transformers.
1370
+ """Construct a :class:` FeatureUnion` from the given transformers.
1366
1371
1367
- This is a shorthand for the FeatureUnion constructor; it does not require,
1368
- and does not permit, naming the transformers. Instead, they will be given
1369
- names automatically based on their types. It also does not allow weighting.
1372
+ This is a shorthand for the :class:`FeatureUnion` constructor; it does not
1373
+ require, and does not permit, naming the transformers. Instead, they will
1374
+ be given names automatically based on their types. It also does not allow
1375
+ weighting.
1370
1376
1371
1377
Parameters
1372
1378
----------
0 commit comments