Recall curve score for XGBoost

Hello ! I have been reading the custom_callback function that autotvm uses to train the XGBoost cost model.

There are a few things that I would like to ask for clarification if possible:

  1. The init function checks if the model (bst) has a best_score attribute which as I understand means that the model has been already trained to some degree so we set the state variables and we can keep doing incremental training. However since the init function only happens once per train at the beginning and each train restarts the model, this code has no use at least by default. Am I understanding this correctly ?

The code from github:

  1. The custom evaluation function that is generated by xgb_average_recalln_curve_score returns the average of N elements of the recall curve score. This N elements are the max N elements according to the pred values. Why dont we just average for all the elements instead ? What am I missing here ?

The code from github:

Thanks !