Skip to content

Instantly share code, notes, and snippets.

@liannewriting
Last active December 7, 2022 15:54
Show Gist options
  • Save liannewriting/8a977a483aecfe94c030414f6b7b25ce to your computer and use it in GitHub Desktop.
Save liannewriting/8a977a483aecfe94c030414f6b7b25ce to your computer and use it in GitHub Desktop.
xgboost python machine learning
from sklearn.pipeline import Pipeline
from category_encoders.target_encoder import TargetEncoder
from xgboost import XGBClassifier
estimators = [
('encoder', TargetEncoder()),
('clf', XGBClassifier(random_state=8)) # can customize objective function with the objective parameter
]
pipe = Pipeline(estimators)
pipe
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment