code: def predict(booster: xgb.Booster, X):
      """A customized prediction function that converts raw prediction to
      target class.
  
      """
      # Output margin means we want to obtain the raw prediction obtained from
      # tree leaf weight.
      predt = booster.predict(X, output_margin=True)
      out = np.zeros(kRows)
      for r in range(predt.shape[0]):
          # the class with maximum prob (not strictly prob as it haven't gone
          # through softmax yet so it doesn't sum to 1, but result is the same
          # for argmax).
          i = np.argmax(predt[r])
          out[r] = i
      return out
  
file_path: xgboost/demo/guide-python/custom_softmax.py
imports: import argparse
  import numpy
  from matplotlib import pyplot
  import xgboost
label_desc: Use image node_id 3 for calling a global function with example usage: predict(booster, X) and returns: out