Skip to content
RED SAG Skills
medium10 pts · first answer countsmachine-learningscikit-learnpipelines

Preprocessing inside a pipeline

What is the main advantage of wrapping preprocessing and the model in one scikit-learn Pipeline like this?

pre = ColumnTransformer([
    ('num', StandardScaler(), ['age', 'income']),
    ('cat', OneHotEncoder(handle_unknown='ignore'), ['city']),
])
pipe = Pipeline([('pre', pre), ('clf', LogisticRegression())])
cross_val_score(pipe, X, y, cv=5)
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions