Skip to content

Instantly share code, notes, and snippets.

@vanbrands
Last active July 23, 2020 17:03
Show Gist options
  • Save vanbrands/b6aaa9c58a9b2ee1450d1374831c1a01 to your computer and use it in GitHub Desktop.
Save vanbrands/b6aaa9c58a9b2ee1450d1374831c1a01 to your computer and use it in GitHub Desktop.
from sklearn.compose import ColumnTransformer
# Define you transformers.
preprocessing = ColumnTransformer(transformers=[
('encode_categorical_features', OneHotEncoder(), ['categorical_column'])
], remainder='passthrough')
estimator = GradientBoostingClassifier()
# Define steps in the pipeline.
pipeline = Pipeline(steps=[
('preprocessing', preprocessing),
('model', estimator)
])
pipeline.fit(x_train, y_train)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment