code: def array_to_predict_df(
      ctx,
      task_type: Literal["binary", "multi", "regression"],
      pred: np.ndarray,
      match_ids: np.ndarray,
      sample_ids: np.ndarray,
      match_id_name: str,
      sample_id_name: str,
      label: np.array = None,
      threshold=0.5,
      classes: list = None,
  ):
      df = pd.DataFrame()
      if len(pred.shape) == 1:
          df[PREDICT_SCORE] = np.array(pred)
      elif len(pred.shape) == 2:
          if pred.shape[1] == 1:
              df[PREDICT_SCORE] = np.array(pred).flatten()
          else:
              df[PREDICT_SCORE] = np.array(pred).tolist()
      else:
          raise ValueError(
              "This is not a FATE std task, pred scores shape are {}".format(
                  pred.shape
              )
          )
  
      if label is not None:
          if len(label.shape) == 1:
              label = label.flatten()
          elif len(label.shape) == 2 and label.shape[1] == 1:
              label = label.flatten()
          else:
              label = label.tolist()
          df[LABEL] = label
  
      df[sample_id_name] = sample_ids.flatten()
      df[match_id_name] = match_ids.flatten()
      fate_df = to_dist_df(ctx, sample_id_name, match_id_name, df)
      predict_result = compute_predict_details(
          fate_df, task_type, classes, threshold
      )
  
      return predict_result
  
file_path: FATE/python/fate/ml/utils/predict_tools.py
imports: import json
  from typing import Literal
  import numpy
  import pandas
  from fate.arch.dataframe import DataFrame
  from fate.arch.dataframe import PandasReader
label_desc: Use image node_id 5 for calling a global function with example usage: array_to_predict_df(ctx, task_type, pred, match_ids, sample_ids, match_id_name, sample_id_name, label, threshold, classes) and returns: predict_result