code: def _format_prediction(
      predictions, target_column, index=None, dtype=np.float64
  ) -> pd.DataFrame:
      """Organize predictions into a standard format, and one-hot encode predictions as necessary
  
      Parameters
      ----------
      predictions: Array-like
          A model's predictions for a set of input data
      target_column: List[str]
          Name(s) for the target column(s) in the returned formatted `predictions` DataFrame
      index: Array-like, or None, default=None
          Index to use for the resulting DataFrame. Defaults to `numpy.arange(len(predictions))`
      dtype: Dtype, or None, default=`numpy.float64`
          Datatype to force on `predictions`. If None, datatype will be inferred
  
      Returns
      -------
      predictions: `pandas.DataFrame`
          Formatted DataFrame containing `predictions` that has been one-hot encoded if necessary
  
      Examples
      --------
      >>> _format_prediction(np.array([3.2, 14.5, 6.8]), ["y"])
            y
      0   3.2
      1  14.5
      2   6.8
      >>> _format_prediction(np.array([1, 0, 1]), ["y"])
           y
      0  1.0
      1  0.0
      2  1.0
      >>> _format_prediction(np.array([2, 1, 0]), ["y_0", "y_1", "y_2"], dtype=np.int8)
         y_0  y_1  y_2
      0    0    0    1
      1    0    1    0
      2    1    0    0"""
      # `target_column` indicates multidimensional output, but predictions are one-dimensional
      if len(target_column) > 1:
          if (len(predictions.shape) == 1) or (
              predictions.shape[1] == 1
          ):
              predictions = pd.get_dummies(predictions).values
  
      return pd.DataFrame(
          data=predictions,
          index=index,
          columns=target_column,
          dtype=dtype,
      )
  
imports: from hyperparameter_hunter.data.data_core import BaseDataChunk
  from hyperparameter_hunter.feature_engineering import FeatureEngineer
  from contextlib import suppress
  from copy import deepcopy
  import numpy
  import pandas
label_desc: Use image node_id 1 for calling a global function with example usage: _format_prediction(predictions, target_column, index, dtype) and returns: pd