code: def fpreproc(dtrain, dtest, param):
      label = dtrain.get_label()
      ratio = float(np.sum(label == 0)) / np.sum(label == 1)
      param["scale_pos_weight"] = ratio
      return (dtrain, dtest, param)
  
imports: import numpy
  import xgboost
label_desc: Use image node_id 1 for calling a global function with example usage: fpreproc(dtrain, dtest, param) and returns: dtrain,  dtest,  param