title: XGBoost Python: XGBoostError: we need weight to evaluate ams
body: <p>i am trying to use XGBoost package in Python
  I have this error when running this code</p>
  
  <pre><code>import xgboost as xgb
  data=np.array(traindata.drop('Category',axis=1))
  labels=np.array(traindata['Category'].cat.codes)
  
  dtrain = xgb.DMatrix( data, label=labels)
  
  param = {'bst:max_depth':6, 'bst:eta':0.5, 'silent':1, 'objective':'multi:softprob' }
  param['nthread'] = 4
  param['eval_metric'] = 'mlogloss'
  param['lambda'] = 1
  param['num_class']=39
  
  evallist  = [(dtrain,'train')]
  
  plst = param.items()
  plst += [('eval_metric', 'ams@0')]
  
  num_round = 10
  bst = xgb.train( plst, dtrain, num_round, evallist )
  
  bst.save_model('0001.model')
  </code></pre>
  
  <blockquote>
    <p>--------------------------------------------------------------------------- XGBoostError                              Traceback (most recent call
    last)  in ()
         17 
         18 num_round = 10
    ---> 19 bst = xgb.train( plst, dtrain, num_round, evallist )
         20 
         21 bst.save_model('0001.model')</p>
    
    <p>/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xgboost/training.pyc
    in train(params, dtrain, num_boost_round, evals, obj, feval, maximize,
    early_stopping_rounds, evals_result, verbose_eval, learning_rates,
    xgb_model)
        122             nboost += 1
        123             if len(evals) != 0:
    --> 124                 bst_eval_set = bst.eval_set(evals, i, feval)
        125                 if isinstance(bst_eval_set, STRING_TYPES):
        126                     msg = bst_eval_set</p>
    
    <p>/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xgboost/core.pyc
    in eval_set(self, evals, iteration, feval)
        753             _check_call(_LIB.XGBoosterEvalOneIter(self.handle, iteration,
        754                                                   dmats, evnames, len(evals),
    --> 755                                                   ctypes.byref(msg)))
        756             return msg.value
        757         else:</p>
    
    <p>/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/xgboost/core.pyc
    in _check_call(ret)
         95     """
         96     if ret != 0:
    ---> 97         raise XGBoostError(_LIB.XGBGetLastError())
         98 
         99 </p>
    
    <p>XGBoostError: we need weight to evaluate ams</p>
  </blockquote>
  
  <p>i don't see anything about it in the docs</p>
  
  <p><a href="https://xgboost.readthedocs.io/en/latest/python/python_intro.html" rel="nofollow">https://xgboost.readthedocs.io/en/latest/python/python_intro.html</a></p>
  
  <p><a href="http://www.analyticsvidhya.com/blog/2016/03/complete-guide-parameter-tuning-xgboost-with-codes-python/" rel="nofollow">http://www.analyticsvidhya.com/blog/2016/03/complete-guide-parameter-tuning-xgboost-with-codes-python/</a></p>