Scikit-learn provides a flexible mechanism for creating pipelines made up of subsequent processing steps. This is possible thanks to a standard interface implemented by the majority of classes; therefore, most of the components (both data processors/transformers and classifiers/clustering tools) can be exchanged seamlessly. The Pipeline class accepts a single steps parameter, which is a list of tuples in the form (name of the component—instance), and creates a complex object with the standard fit/transform interface. For example, if we need to apply a PCA, a standard scaling, and then we want to classify using an SVM, we could create a pipeline in the following way:
from sklearn.decomposition import PCAfrom sklearn.pipeline import ...