class_docstr: Compiler for Model Interpreter
  
  Param:
      package (str, Optional): component package name
      module (str, Optional): component module name
      class (str): component class name
  
  Attr:
      domain (str): User-provided domain
      method: (str, Optional) interpreter method, default (lime) = 'default'
  
      ** For Model Interpretation **
      mode: (str, Optional) classification/regression model,
              default = 'classification'
      train_data: numpy.dnarray - Training data
              Each row is a training sample, each column is a feature
      labels: a list of str/int, the class label for each training sample
      predict_func: model object or path to predict function call pickle
      feature_names: array-list of feature names
      target_names: array-list of target names
      model_interpret_stats_type: str, default = 'top_k'
              The pre-defined stats_type for statistical analysis.
              - top_k: how often a feature appears in the top K features in the explanation
              - average_score: average score for each feature in the explanation
              - average_ranking: average ranking for each feature in the explanation
      model_interpret_k_value: int, the k value for `top_k` method and `average_ranking`
              It will be ignored if the stats type are not `top_k` or `average_ranking`
              Default value of k is 5
      model_interpret_top_value: int, the number of top explanation to display
              Default value is 15
  
      ** For Error Analysis **
      enable_error_analysis: bool set to True to enable error analysis else False to disable
              Default value is False - error analysis disabled
      num_of_class: int, number of classes
      valid_x: A list of 1D ndarray. Validation data
      valid_y: A list of int or a list of str. Validation ground truth class label (str) or (index)
              The type should be consistent to the classes label passed in when building the model interpreter
      error_analysis_stats_type: str, pre-defined types. For now, it supports 3 types:
              - top_k: how often a feature appears in the top K features in the explanation
              - average_score: average score for each feature in the explanation
              - average_ranking: average ranking for each feature in the explanation
              Default type is `top_k`
      error_analysis_k_value:  int, not None. the k value for `top_k` method and `average_ranking`
              It will be ignored if the stats type are not `top_k` or `average_ranking`
              Default value of k is 5
      error_analysis_top_value: int, the number of top error analysis explanation to display
              Default value is 15
  
  Example:
      "component": {
          "package": "xai",
          "module": "compiler",
          "class": "ModelInterpreter",
          "attr": {
              "domain": "tabular",
              "method": "lime",
              "mode": "classification",
              "train_data": "var:X_train",
              "labels": "var:y_train",
              "predict_func": "var:clf",
              "feature_names": "var:feature_names",
              "target_names": "var:target_names_list",
              "model_interpret_stats_type": "top_k",
              "model_interpret_k_value": 5,
              "model_interpret_top_value": 15,
              "num_of_class": 2,
              "valid_x": "var:X_test",
              "valid_y": "var:y_test",
              "error_analysis_stats_type": "average_score",
              "error_analysis_k_value": 5,
              "error_analysis_top_value": 15,
              "enable_error_analysis": true
          }
      }
docstr: Init
  
  Args:
      dictionary (dict): attribute to set
docstr_tok: ["Init","Args",":","dictionary","(","dict",")",":","attribute","to","set"]
code: def __init__(self, dictionary):
      """
      Init
  
      Args:
          dictionary (dict): attribute to set
      """
      super(ModelInterpreter, self).__init__(
          dictionary, schema=self.schema
      )
  
file_path: contextual-ai/xai/compiler/model.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  from pandas import DataFrame
  from scipy.sparse.csr import csr_matrix
  from xai.compiler.base import Dict2Obj
  from xai.formatter import Report
  from xai.model.interpreter import ModelInterpreter
  from xai import ALG, MODE
label_desc: Use image node_id 1 to create a new ModelInterpreter object from inherited base classes: Dict2Obj with example: obj = ModelInterpreter(dictionary)