@@ -600,15 +600,50 @@ def _fit_sample_one(sampler, X, y, **fit_params):
600600 return X_res , y_res , sampler
601601
602602
603- def make_pipeline (* steps ):
603+ def make_pipeline (* steps , ** kwargs ):
604604 """Construct a Pipeline from the given estimators.
605605
606606 This is a shorthand for the Pipeline constructor; it does not require, and
607607 does not permit, naming the estimators. Instead, their names will be set
608608 to the lowercase of their types automatically.
609609
610+ Parameters
611+ ----------
612+ *steps : list of estimators.
613+
614+ memory : None, str or object with the joblib.Memory interface, optional
615+ Used to cache the fitted transformers of the pipeline. By default,
616+ no caching is performed. If a string is given, it is the path to
617+ the caching directory. Enabling caching triggers a clone of
618+ the transformers before fitting. Therefore, the transformer
619+ instance given to the pipeline cannot be inspected
620+ directly. Use the attribute ``named_steps`` or ``steps`` to
621+ inspect estimators within the pipeline. Caching the
622+ transformers is advantageous when fitting is time consuming.
623+
610624 Returns
611625 -------
612626 p : Pipeline
627+
628+ See also
629+ --------
630+ imblearn.pipeline.Pipeline : Class for creating a pipeline of
631+ transforms with a final estimator.
632+
633+ Examples
634+ --------
635+ >>> from sklearn.naive_bayes import GaussianNB
636+ >>> from sklearn.preprocessing import StandardScaler
637+ >>> make_pipeline(StandardScaler(), GaussianNB(priors=None))
638+ ... # doctest: +NORMALIZE_WHITESPACE
639+ Pipeline(memory=None,
640+ steps=[('standardscaler',
641+ StandardScaler(copy=True, with_mean=True, with_std=True)),
642+ ('gaussiannb',
643+ GaussianNB(priors=None))])
613644 """
614- return Pipeline (pipeline ._name_estimators (steps ))
645+ memory = kwargs .pop ('memory' , None )
646+ if kwargs :
647+ raise TypeError ('Unknown keyword arguments: "{}"'
648+ .format (list (kwargs .keys ())[0 ]))
649+ return Pipeline (pipeline ._name_estimators (steps ), memory = memory )
0 commit comments