Skip to content

Instantly share code, notes, and snippets.

@tldrafael
Created March 26, 2020 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tldrafael/863f0d51717691d1348edc19ca718d46 to your computer and use it in GitHub Desktop.
Save tldrafael/863f0d51717691d1348edc19ca718d46 to your computer and use it in GitHub Desktop.
xgb_params = {'objective': 'multi:softmax',
'num_class': 19,
'tree_method': 'exact',
# 'max_bin': 64,
'colsample_bytree': 0.75,
'subsample': 0.75,
# 'lambda': 2,
# 'alpha': 2,
# 'min_child_weight': 10,
# 'max_delta_step': 10,
'max_depth': 10,
'eval_metric': ['mlogloss'],
'learning_rate': 0.03}
cv_hist = xgb.cv(params=xgb_params,
dtrain=dm_train,
verbose_eval=25,
folds=email_folds,
num_boost_round=10000,
early_stopping_rounds=100)
best_iter = np.argmin(cv_hist['test-mlogloss-mean'])
gbm_model = xgb.train(xgb_params,
dm_train,
verbose_eval=100,
num_boost_round=best_iter)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment