code: def logregobj(preds, dtrain):
      labels = dtrain.get_label()
      preds = 1.0 / (1.0 + np.exp(-preds))
      grad = preds - labels
      hess = preds * (1.0 - preds)
      return grad, hess
  
imports: import numpy
  import xgboost
label_desc: Use image node_id 2 for calling a global function with example usage: logregobj(preds, dtrain) and returns: grad,  hess