code: def format_categorical_preds(
      predictions, original_y, df_to_predict, target_col
  ):
      """Transforms class predictions back to their original class.
  
      Categoric predictions come out the AutoKeras model in a binary
      format e.g. (0, 1, 0). This function maps them back to their
      original class e.g. 'Blue', and adds a DF column for the
      model confidence score.
      """
      # Turn prediction back into categorical value
      lb = preprocessing.LabelBinarizer()
      lb.fit(original_y)
      preds = lb.inverse_transform(predictions)
  
      # Add the confidence score next to the prediction
      df_to_predict[target_col] = pd.Series(preds).astype(
          original_y.dtype
      )
      df_to_predict["confidence"] = [
          max(row) for _, row in enumerate(predictions)
      ]
      return df_to_predict
  
file_path: mindsdb/mindsdb/integrations/handlers/autokeras_handler/autokeras_handler.py
imports: import os
  import random
  import string
  from typing import Optional
  import numpy
  import pandas
  import autokeras
  from sklearn import preprocessing
  from tensorflow.keras.models import load_model
  from mindsdb.integrations.libs.base import BaseMLEngine
label_desc: Use image node_id 3 for calling a global function with example usage: format_categorical_preds(predictions, original_y, df_to_predict, target_col) and returns: df_to_predict