docstr: Constructor for the explainer.
  
  # Inputs
  
  :param model: (LudwigModel) The LudwigModel to explain.
  :param inputs_df: (pd.DataFrame) The input data to explain.
  :param sample_df: (pd.DataFrame) A sample of the ground truth data.
  :param target: (str) The name of the target to explain.
docstr_tok: ["Constructor","for","the","explainer",".","#","Inputs",":","param","model",":","(","LudwigModel",")","The","LudwigModel","to","explain",".",":","param","inputs_df",":","(","pd.DataFrame",")","The","input","data","to","explain",".",":","param","sample_df",":","(","pd.DataFrame",")","A","sample","of","the","ground","truth","data",".",":","param","target",":","(","str",")","The","name","of","the","target","to","explain","."]
code: def __init__(
      self,
      model: LudwigModel,
      inputs_df: pd.DataFrame,
      sample_df: pd.DataFrame,
      target: str,
  ):
      """Constructor for the explainer.
  
      # Inputs
  
      :param model: (LudwigModel) The LudwigModel to explain.
      :param inputs_df: (pd.DataFrame) The input data to explain.
      :param sample_df: (pd.DataFrame) A sample of the ground truth data.
      :param target: (str) The name of the target to explain.
      """
      self.model = model
      self.inputs_df = inputs_df
      self.sample_df = sample_df
      self.target = target
      (
          self.inputs_df,
          self.sample_df,
          self.feature_cols,
          self.target_feature_name,
      ) = prepare_data(model, inputs_df, sample_df, target)
  
      self.global_explanation = Explanation(self.target_feature_name)
      self.row_explanations = [
          Explanation(self.target_feature_name)
          for _ in self.inputs_df.index
      ]
  
      # Lookup from column name to output feature
      config = self.model.config
      self.output_feature_map = {
          feature["column"]: feature
          for feature in config["output_features"]
      }
  
file_path: ludwig/ludwig/explain/explainer.py
imports: from abc import ABCMeta, abstractmethod
  import pandas
  from ludwig.api import LudwigModel
  from ludwig.api_annotations import DeveloperAPI
  from ludwig.constants import BINARY, CATEGORY, TYPE
  from ludwig.explain.explanation import Explanation, ExplanationsResult
  from ludwig.explain.util import prepare_data
label_desc: Use image node_id 1 to create a new Explainer object  with example: obj = Explainer(model, inputs_df, sample_df, target)