@@ -47,7 +47,7 @@ class Pipeline(pipeline.Pipeline):
4747 fit/transform/fit_resample) that are chained, in the order in which
4848 they are chained, with the last object an estimator.
4949
50- memory : Instance of joblib.Memory or string, optional ( default=None)
50+ memory : Instance of joblib.Memory or str, default=None
5151 Used to cache the fitted transformers of the pipeline. By default,
5252 no caching is performed. If a string is given, it is the path to
5353 the caching directory. Enabling caching triggers a clone of
@@ -57,7 +57,7 @@ class Pipeline(pipeline.Pipeline):
5757 inspect estimators within the pipeline. Caching the
5858 transformers is advantageous when fitting is time consuming.
5959
60- verbose : boolean, optional ( default=False)
60+ verbose : bool, default=False
6161 If True, the time elapsed while fitting each step will be printed as it
6262 is completed.
6363
@@ -67,17 +67,16 @@ class Pipeline(pipeline.Pipeline):
6767 Read-only attribute to access any step parameter by user given name.
6868 Keys are step names and values are steps parameters.
6969
70+ See Also
71+ --------
72+ make_pipeline : Helper function to make pipeline.
73+
7074 Notes
7175 -----
7276 See :ref:`sphx_glr_auto_examples_pipeline_plot_pipeline_classification.py`
7377
74- See also
75- --------
76- make_pipeline : helper function to make pipeline.
77-
7878 Examples
7979 --------
80-
8180 >>> from collections import Counter
8281 >>> from sklearn.datasets import make_classification
8382 >>> from sklearn.model_selection import train_test_split as tts
@@ -109,7 +108,6 @@ class Pipeline(pipeline.Pipeline):
109108 macro avg 0.93 0.99 0.96 250
110109 weighted avg 0.99 0.98 0.98 250
111110 <BLANKLINE>
112-
113111 """
114112
115113 # BaseEstimator interface
@@ -257,7 +255,7 @@ def _fit(self, X, y=None, **fit_params):
257255 return X , y , fit_params_steps [self .steps [- 1 ][0 ]]
258256
259257 def fit (self , X , y = None , ** fit_params ):
260- """Fit the model
258+ """Fit the model.
261259
262260 Fit all the transforms/samplers one after the other and
263261 transform/sample the data, then fit the transformed/sampled
@@ -273,16 +271,15 @@ def fit(self, X, y=None, **fit_params):
273271 Training targets. Must fulfill label requirements for all steps of
274272 the pipeline.
275273
276- **fit_params : dict of string -> object
274+ **fit_params : dict of str -> object
277275 Parameters passed to the ``fit`` method of each step, where
278276 each parameter name is prefixed such that parameter ``p`` for step
279277 ``s`` has key ``s__p``.
280278
281279 Returns
282280 -------
283281 self : Pipeline
284- This estimator
285-
282+ This estimator.
286283 """
287284 Xt , yt , fit_params = self ._fit (X , y , ** fit_params )
288285 with _print_elapsed_time ('Pipeline' ,
@@ -292,7 +289,7 @@ def fit(self, X, y=None, **fit_params):
292289 return self
293290
294291 def fit_transform (self , X , y = None , ** fit_params ):
295- """Fit the model and transform with the final estimator
292+ """Fit the model and transform with the final estimator.
296293
297294 Fits all the transformers/samplers one after the other and
298295 transform/sample the data, then uses fit_transform on
@@ -315,9 +312,8 @@ def fit_transform(self, X, y=None, **fit_params):
315312
316313 Returns
317314 -------
318- Xt : array-like, shape = [n_samples, n_transformed_features]
319- Transformed samples
320-
315+ Xt : array-like of shape (n_samples, n_transformed_features)
316+ Transformed samples.
321317 """
322318 last_step = self ._final_estimator
323319 Xt , yt , fit_params = self ._fit (X , y , ** fit_params )
@@ -331,7 +327,7 @@ def fit_transform(self, X, y=None, **fit_params):
331327 return last_step .fit (Xt , yt , ** fit_params ).transform (Xt )
332328
333329 def fit_resample (self , X , y = None , ** fit_params ):
334- """Fit the model and sample with the final estimator
330+ """Fit the model and sample with the final estimator.
335331
336332 Fits all the transformers/samplers one after the other and
337333 transform/sample the data, then uses fit_resample on transformed
@@ -354,12 +350,11 @@ def fit_resample(self, X, y=None, **fit_params):
354350
355351 Returns
356352 -------
357- Xt : array-like, shape = [n_samples, n_transformed_features]
358- Transformed samples
359-
360- yt : array-like, shape = [n_samples, n_transformed_features]
361- Transformed target
353+ Xt : array-like of shape (n_samples, n_transformed_features)
354+ Transformed samples.
362355
356+ yt : array-like of shape (n_samples, n_transformed_features)
357+ Transformed target.
363358 """
364359 last_step = self ._final_estimator
365360 Xt , yt , fit_params = self ._fit (X , y , ** fit_params )
@@ -372,7 +367,7 @@ def fit_resample(self, X, y=None, **fit_params):
372367
373368 @if_delegate_has_method (delegate = "_final_estimator" )
374369 def fit_predict (self , X , y = None , ** fit_params ):
375- """Applies fit_predict of last step in pipeline after transforms.
370+ """Apply ` fit_predict` of last step in pipeline after transforms.
376371
377372 Applies fit_transforms of a pipeline to the data, followed by the
378373 fit_predict method of the final estimator in the pipeline. Valid
@@ -395,7 +390,8 @@ def fit_predict(self, X, y=None, **fit_params):
395390
396391 Returns
397392 -------
398- y_pred : array-like
393+ y_pred : ndarray of shape (n_samples,)
394+ The predicted target.
399395 """
400396 Xt , yt , fit_params = self ._fit (X , y , ** fit_params )
401397 with _print_elapsed_time ('Pipeline' ,
@@ -425,9 +421,10 @@ def make_pipeline(*steps, **kwargs):
425421
426422 Parameters
427423 ----------
428- *steps : list of estimators.
424+ *steps : list of estimators
425+ A list of estimators.
429426
430- memory : None, str or object with the joblib.Memory interface, optional
427+ memory : None, str or object with the joblib.Memory interface, default=None
431428 Used to cache the fitted transformers of the pipeline. By default,
432429 no caching is performed. If a string is given, it is the path to
433430 the caching directory. Enabling caching triggers a clone of
@@ -437,15 +434,15 @@ def make_pipeline(*steps, **kwargs):
437434 inspect estimators within the pipeline. Caching the
438435 transformers is advantageous when fitting is time consuming.
439436
440- verbose : boolean, optional ( default=False)
437+ verbose : bool, default=False
441438 If True, the time elapsed while fitting each step will be printed as it
442439 is completed.
443440
444441 Returns
445442 -------
446443 p : Pipeline
447444
448- See also
445+ See Also
449446 --------
450447 imblearn.pipeline.Pipeline : Class for creating a pipeline of
451448 transforms with a final estimator.
0 commit comments