code: def predict(model: dict, param: list) -> Union[str, int, float]:
      """
      Predict the target label of given features from a pre-trained model
      Args:
          model (built chefboost model): pre-trained model which is the output
              of fit function
          param (list): pass input features as python list
              e.g. chef.predict(model, param = ['Sunny', 'Hot', 'High', 'Weak'])
      Returns:
              prediction
      """
  
      trees = model["trees"]
      config = model["config"]
  
      alphas = []
      if "alphas" in model:
          alphas = model["alphas"]
  
      nan_values = []
      if "nan_values" in model:
          nan_values = model["nan_values"]
  
      # -----------------------
      # handle missing values
  
      column_index = 0
      for column in nan_values:
          column_name = column[0]
          missing_value = column[1]
  
          if pd.isna(missing_value) != True:
              logger.debug(
                  f"missing values will be replaced with {missing_value} in {column_name} column"
              )
  
              if pd.isna(param[column_index]):
                  param[column_index] = missing_value
  
          column_index = column_index + 1
  
      logger.debug(f"instance: {param}")
      # -----------------------
  
      enableGBM = config["enableGBM"]
      adaboost = config["enableAdaboost"]
      enableRandomForest = config["enableRandomForest"]
  
      # -----------------------
  
      classification = False
      prediction = 0
      prediction_classes = []
  
      # -----------------------
  
      if enableGBM == True:
          if len(trees) == config["epochs"]:
              classification = False
          else:
              classification = True
              prediction_classes = [0 for i in alphas]
  
      # -----------------------
  
      if len(trees) > 1:  # bagging or boosting
          index = 0
          for tree in trees:
              if adaboost != True:
                  custom_prediction = tree.findDecision(param)
  
                  if custom_prediction != None:
                      if not isinstance(
                          custom_prediction, str
                      ):  # regression
                          if (
                              enableGBM == True
                              and classification == True
                          ):
                              prediction_classes[
                                  index % len(alphas)
                              ] += custom_prediction
                          else:
                              prediction += custom_prediction
                      else:
                          classification = True
                          prediction_classes.append(custom_prediction)
              else:  # adaboost
                  prediction += alphas[index] * tree.findDecision(param)
              index = index + 1
  
          if enableRandomForest == True:
              # notice that gbm requires cumilative sum but random forest requires mean of each tree
              prediction = prediction / len(trees)
  
          if adaboost == True:
              prediction = functions.sign(prediction)
      else:  # regular decision tree
          tree = trees[0]
          prediction = tree.findDecision(param)
  
      if classification == False:
          return prediction
      else:
          if enableGBM == True and classification == True:
              return alphas[np.argmax(prediction_classes)]
          else:  # classification
              # e.g. random forest
              # get predictions made by different trees
              predictions = np.array(prediction_classes)
  
              # find the most frequent prediction
              (values, counts) = np.unique(
                  predictions, return_counts=True
              )
              idx = np.argmax(counts)
              prediction = values[idx]
  
              return prediction
  
file_path: chefboost/chefboost/Chefboost.py
imports: import time
  import pickle
  import os
  import json
  from typing import Optional, Dict, Any, Union
  import numpy
  import pandas
  from chefboost.commons import functions, evaluate
  from chefboost.training import Training
  from chefboost.tuning import gbm, adaboost, randomforest
  from chefboost.commons.logger import Logger
label_desc: Use image node_id 2 for calling a global function with example usage: predict(model, param) and returns: prediction, alphas, prediction