clf = XGBClassifier(learning_rate = 0.01,
					n_estimators = 5000, 
					reg_alpha = 0.025, 
					colsample_bytree = 0.8, 
					silent	= 1, 
					scale_pos_weight = 0, 					
					nthread = 4, 
					min_child_weight = 1, 
					subsample= 0.8, 
					seed = 1337, 
					objective= 'multi:softprob', 
					max_depth = 7, 
					gamma= .2)

# use the xgb interface
xgb_param = clf.get_xgb_params()
xgb_param['num_class'] = 5
xgb_param['eval_metric'] = 'mlogloss'
Xg_train = xgb.DMatrix(X_train, label=y_train, missing=np.nan)
cvresult = xgb.cv(xgb_param, 
				  Xg_train, 
 				  num_boost_round = clf.get_params()['n_estimators'],
 				  nfold = 5,
 				  show_progress = True,
				  early_stopping_rounds = 100)
clf.set_params(n_estimators=cvresult.shape[0])
clf.fit(X_train, y_train)
best_outcome_params = clf.get_params()
best_outcome_score = cvresult.min()

try: