@@ -53,12 +53,15 @@ def check(self):
53
53
54
54
class Pipeline (_BaseComposition ):
55
55
"""
56
- Pipeline of transforms with a final estimator.
56
+ A sequence of data transformers with an optional final predictor.
57
+
58
+ `Pipeline` allows you to sequentially apply a list of transformers to
59
+ preprocess the data and, if desired, conclude the sequence with a final
60
+ :term:`predictor` for predictive modeling.
57
61
58
- Sequentially apply a list of transforms and a final estimator.
59
62
Intermediate steps of the pipeline must be 'transforms', that is, they
60
63
must implement `fit` and `transform` methods.
61
- The final estimator only needs to implement `fit`.
64
+ The final :term:` estimator` only needs to implement `fit`.
62
65
The transformers in the pipeline can be cached using ``memory`` argument.
63
66
64
67
The purpose of the pipeline is to assemble several steps that can be
@@ -81,10 +84,11 @@ class Pipeline(_BaseComposition):
81
84
82
85
Parameters
83
86
----------
84
- steps : list of tuple
85
- List of (name, transform) tuples (implementing `fit`/`transform`) that
86
- are chained in sequential order. The last transform must be an
87
- estimator.
87
+ steps : list of tuples
88
+ List of (name of step, estimator) tuples that are to be chained in
89
+ sequential order. To be compatible with the scikit-learn API, all steps
90
+ must define `fit`. All non-last steps must also define `transform`. See
91
+ :ref:`Combining Estimators <combining_estimators>` for more details.
88
92
89
93
memory : str or object with the joblib.Memory interface, default=None
90
94
Used to cache the fitted transformers of the pipeline. The last step
@@ -414,7 +418,7 @@ def _fit(self, X, y=None, routed_params=None):
414
418
def fit (self , X , y = None , ** params ):
415
419
"""Fit the model.
416
420
417
- Fit all the transformers one after the other and transform the
421
+ Fit all the transformers one after the other and sequentially transform the
418
422
data. Finally, fit the transformed data using the final estimator.
419
423
420
424
Parameters
@@ -478,9 +482,9 @@ def _can_fit_transform(self):
478
482
def fit_transform (self , X , y = None , ** params ):
479
483
"""Fit the model and transform with the final estimator.
480
484
481
- Fits all the transformers one after the other and transform the
482
- data. Then uses `fit_transform` on transformed data with the final
483
- estimator .
485
+ Fit all the transformers one after the other and sequentially transform
486
+ the data. Only valid if the final estimator either implements
487
+ `fit_transform` or `fit` and `transform` .
484
488
485
489
Parameters
486
490
----------
0 commit comments