Examples -------- from sklearn.svm import SVC from sklearn.preprocessing import StandardScaler from sklearn.datasets import make_classification from sklearn.model_selection import train_test_split from sklearn.pipeline import Pipeline X, y = make_classification(random_state=0) X_train, X_test, y_train, y_test = train_test_split(X, y, ... random_state=0) pipe = Pipeline([('scaler', StandardScaler()), ('svc', SVC())]) # The pipeline can be used as any other estimator # and avoids leaking the test set into the train set pipe.fit(X_train, y_train) Pipeline(steps=[('scaler', StandardScaler()), ('svc', SVC())]) pipe.score(X_test, y_test) 0.88 |