scikit-learn 1 · Preprocessing and pipelines
Chain steps into a pipeline
Combine preprocessing and a model so the same steps apply in training and prediction, with no data leakage.
from sklearn.pipeline import make_pipeline
from sklearn.linear_model import LogisticRegression
model = make_pipeline(StandardScaler(), LogisticRegression(max_iter=1000))
model.fit(X_train, y_train)
Official scikit-learn 1 documentation
More preprocessing and pipelines commands
All preprocessing and pipelines commands · scikit-learn 1 cheatsheet