Last active
December 6, 2022 16:30
-
-
Save liannewriting/31465b1d7100fd78c57553e7306f5af9 to your computer and use it in GitHub Desktop.
xgboost python machine learning
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from skopt import BayesSearchCV | |
from skopt.space import Real, Categorical, Integer | |
search_space = { | |
'clf__max_depth': Integer(2,8), | |
'clf__learning_rate': Real(0.001, 1.0, prior='log-uniform'), | |
'clf__subsample': Real(0.5, 1.0), | |
'clf__colsample_bytree': Real(0.5, 1.0), | |
'clf__colsample_bylevel': Real(0.5, 1.0), | |
'clf__colsample_bynode' : Real(0.5, 1.0), | |
'clf__reg_alpha': Real(0.0, 10.0), | |
'clf__reg_lambda': Real(0.0, 10.0), | |
'clf__gamma': Real(0.0, 10.0) | |
} | |
opt = BayesSearchCV(pipe, search_space, cv=3, n_iter=10, scoring='roc_auc', random_state=8) # in reality, you may consider setting cv and n_iter to higher values |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment