Created
April 21, 2015 21:49
-
-
Save grapefroot/864df7feb47e425902a4 to your computer and use it in GitHub Desktop.
XGboost usage example
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
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