code: def ai(self, df, y, model, model_name="xgboost", mode=None):
      y_variable = "y_actual"
      y_variable_predict = "y_prediction"
  
      # Code for Analytics
      instance_id = self.random_string_generator()
      analytics = Analytics()
      analytics["ip"] = analytics.finding_ip()
      analytics["mac"] = analytics.finding_address()
      analytics["instance_id"] = instance_id
      analytics["time"] = str(datetime.datetime.now())
      analytics["total_columns"] = len(df.columns)
      analytics["total_rows"] = len(df)
      analytics["os"] = analytics.finding_system()
      analytics["model_name"] = model_name
      analytics["function"] = "before_dashboard"
      analytics["query"] = "before_dashboard"
      analytics["finish_time"] = ""
      analytics.insert_data()
  
      prediction_col = []
  
      if model_name == "xgboost":
          import xgboost
  
          if xgboost.__version__ in [
              "1.1.0",
              "1.1.1",
              "1.1.0rc2",
              "1.1.0rc1",
          ]:
              print(
                  "Current Xgboost version is not supported. Please install Xgboost using 'pip install xgboost==1.0.2'"
              )
              return False
          prediction_col = model.predict(xgboost.DMatrix(df))
  
      elif model_name == "catboost":
          prediction_col = model.predict(df.to_numpy())
  
      else:
          prediction_col = model.predict(df)
  
      # is classification?
      # is_classification = self.is_classification_given_y_array(prediction_col)
      ModelType = lambda model: True if is_classifier(model) else False
      is_classification = ModelType(model)
  
      # shap
      c = calculate_shap()
      self.df_final, self.explainer = c.find(
          model,
          df,
          prediction_col,
          is_classification,
          model_name=model_name,
      )
  
      # Append Model Decision & True Labels Columns into the dataset.
      self.df_final[y_variable_predict] = prediction_col
      self.df_final[y_variable] = y
  
      # additional inputs.
      if is_classification == True:
          # find and add probabilities in the dataset.
          # prediction_col_prob = model.predict_proba(df)
          # pd_prediction_col_prob = pd.DataFrame(prediction_col_prob)
  
          probabilities = model.predict_proba(df)
  
          for i in range(len(np.unique(prediction_col))):
              self.df_final[
                  "Probability: {}".format(np.unique(prediction_col)[i])
              ] = probabilities[:, i]
  
          self.param["classes"] = np.unique(prediction_col)
  
          # for c in pd_prediction_col_prob.columns:
          #   self.df_final["probability_of_predicting_class_" + str(c)] = list(pd_prediction_col_prob[c])
  
          # classes = []
          # for c in pd_prediction_col_prob.columns:
          #   classes.append(str(c))
          # self.param["classes"] = classes
  
          try:
              expected_values_by_class = self.explainer.expected_value
          except:
              expected_values_by_class = []
              for c in range(len(np.unique(prediction_col))):
                  expected_values_by_class.append(
                      1 / len(np.unique(prediction_col))
                  )
  
          self.param["expected_values"] = expected_values_by_class
      else:
          try:
              expected_values = self.explainer.expected_value
              self.param["expected_values"] = [expected_values]
          except:
              expected_value = [round(np.array(y).mean(), 2)]
              self.param["expected_values"] = expected_value
  
      self.param["is_classification"] = is_classification
      self.param["model_name"] = model_name
      self.param["model"] = model
      self.param["columns"] = df.columns
      self.param["y_variable"] = y_variable
      self.param["y_variable_predict"] = y_variable_predict
      self.param["instance_id"] = instance_id
  
      d = dashboard()
      d.find(self.df_final, mode, self.param)
  
      return True
  
imports: import os
  import sys
  import re
  from pathlib import Path
  from sys import platform
  import subprocess
  import time
  from imports import *
  from dashboard import *
  from calculate_shap import *
  from analytics import Analytics
label_desc: Use image node_id 4 for calling the explain obj's underlying member method code with example usage: obj.ai(df, y, model, model_name, mode) and returns: True, False