Sunny-Island commented on issue #12009:
URL: https://github.com/apache/tvm/issues/12009#issuecomment-1180114920

   > Thanks for submitting the first PR! I just sent a couple comments, let me 
know if you have any questions!
   
   I am working on upgrading the callback function in AutoScheduler XGBoost 
Cost Model. I noticed some codes are related with crossfold(cv), but I'm not 
clear when will the crossfold function be called? When the env.cvfolds will 
become true?
   In latest xgboost code, it seems that crossfold is a dependent function. And 
deprecated `train` method will set `cvfold=None`.
   
https://github.com/dmlc/xgboost/blob/e7decb9775dae440fd829fd37d1f56c5bcedb138/python-package/xgboost/training.py#L74
   
   Ignore this reply if you are not familiar with this part.
   ```python
   def callback(env):
       """internal function"""
       if not state:
           init(env)
   
       bst = env.model
       i = env.iteration
       cvfolds = env.cvfolds
   
       res_dict = {}
   
       if i % skip_every == 1:
           return
   
       ##### evaluation #####
       if cvfolds is not None:
           for feval in fevals:
               tmp = aggcv([f.eval(i, feval) for f in cvfolds])
               for k, mean, std in tmp:
                   res_dict[k] = [mean, std]
       else:
           for feval in fevals:
               bst_eval = bst.eval_set(evals, i, feval)
               res = [x.split(":") for x in bst_eval.split()]
               for kv in res[1:]:
                   res_dict[kv[0]] = [float(kv[1])]
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to