code: def predict_multiclass_shap(model: Booster, data):
      """
      Returns a 3d array of shape (samples, columns, classes)
      It is faster to copy into a new array than delete from
      the old one.
      """
      preds = model.predict(data, pred_contrib=True)
      samples, cols = data.shape
      classes = model._Booster__num_class  # type: ignore
      p = np.empty(shape=(samples, cols * classes), dtype=preds.dtype)  # type: ignore
      for c in range(classes):
          s1 = slice(c * cols, (c + 1) * cols)
          s2 = slice(c * (cols + 1), (c + 1) * (cols + 1) - 1)
          p[:, s1] = preds[:, s2]  # type: ignore
  
      # If objective is random forest, the shap values are summed
      # without ever taking an average, so we divide by the iters
      _adjust_shap_for_rf(model, p)
  
      return p
  
file_path: miceforest/miceforest/builtin_pred_funcs.py
imports: from .utils import logodds
  from lightgbm import Booster
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: predict_multiclass_shap(model, data) and returns: p