Skip to content

Instantly share code, notes, and snippets.

@grapefroot
Created April 21, 2015 21:49
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 grapefroot/864df7feb47e425902a4 to your computer and use it in GitHub Desktop.
Save grapefroot/864df7feb47e425902a4 to your computer and use it in GitHub Desktop.
XGboost usage example
param = {}
param['booster'] = 'gbtree'
param['objective'] = 'multi:softprob'
param['eval_metric'] = 'mlogloss'
param['num_class'] = 9
param['silent'] = 1
param['nthread'] = 1
num_round = 5000
plst = list(param.items())
Gtrain = xgb.DMatrix( gtrain, label = ytrain.values[:,0] - 1 )
Gtest = xgb.DMatrix( gtest, label = ycv.values[:,0] - 1 )
evallist = [(Gtrain,'train'), (Gtest,'test')]
bst = xgb.train( plst, Gtrain, num_round, evallist, early_stopping_rounds = 10 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment