skada.make_da_pipeline
- skada.make_da_pipeline(*steps, memory: Memory | None = None, verbose: bool = False, default_selector: str | Callable[[BaseEstimator], BaseSelector] = 'shared') Pipeline [source]
Construct a
Pipeline
from the given estimators.This is a shorthand for the
sklearn.pipeline.Pipeline
constructor; it does not require, and does not permit, naming the estimators. Instead, their names will be set to the lowercase of their types automatically.- Parameters:
- *stepslist of estimators or tuples of the form (name of step, estimator).
List of the scikit-learn estimators that are chained together.
- memorystr or object with the joblib.Memory interface, default=None
Used to cache the fitted transformers of the pipeline. The last step will never be cached, even if it is a transformer. By default, no caching is performed. If a string is given, it is the path to the caching directory. Enabling caching triggers a clone of the transformers before fitting. Therefore, the transformer instance given to the pipeline cannot be inspected directly. Use the attribute
named_steps
orsteps
to inspect estimators within the pipeline. Caching the transformers is advantageous when fitting is time consuming.- verbosebool, default=False
If True, the time elapsed while fitting each step will be printed as it is completed.
- default_selectorstr or callable, default = 'shared'
Specifies a domain selector to wrap the estimator, if it is not already wrapped. Refer to
BaseSelector
for an understanding of selector functionalities. The available options include 'shared' and 'per_domain'. For integrating a custom selector as the default, pass a callable that acceptsBaseEstimator
and returns the estimator encapsulated within a domain selector.
- Returns:
- pPipeline
Returns a scikit-learn
Pipeline
object.
Examples
>>> from sklearn.naive_bayes import GaussianNB >>> from sklearn.preprocessing import StandardScaler >>> from skada import make_da_pipeline >>> make_da_pipeline(StandardScaler(), GaussianNB(priors=None)) Pipeline(steps=[('standardscaler', Shared(base_estimator=StandardScaler(), copy=True, with_mean=True, with_std=True)), ('gaussiannb', Shared(base_estimator=GaussianNB(), priors=None, var_smoothing=1e-09))])
Examples using skada.make_da_pipeline
Optimal Transport Domain Adaptation (OTDA)
Using cross_val_score with skada