class_docstr: Defines the ExplainerManager for explaining a model.
class_docstr_tok: ["Defines","the","ExplainerManager","for","explaining","a","model","."]
docstr: Add an explainer to be computed later.
docstr_tok: ["Add","an","explainer","to","be","computed","later","."]
code: def add(self):
      """Add an explainer to be computed later."""
      if self._model is None:
          raise UserConfigValidationException(
              "Model is required for model explanations"
          )
  
      categorical_features_with_missing_values_train = set(
          _find_features_having_missing_values(
              self._initialization_examples
          )
      ) & set(self._categorical_features)
      if any(categorical_features_with_missing_values_train):
          raise UserConfigValidationException(
              "Categorical features {0} cannot have missing "
              "values for computing explanations. "
              "Please check your training data.".format(
                  ",".join(
                      categorical_features_with_missing_values_train
                  )
              )
          )
  
      categorical_features_with_missing_values_test = set(
          _find_features_having_missing_values(
              self._evaluation_examples
          )
      ) & set(self._categorical_features)
      if any(categorical_features_with_missing_values_test):
          raise UserConfigValidationException(
              "Categorical features {0} cannot have missing "
              "values for computing explanations. "
              "Please check your test data.".format(
                  ",".join(
                      categorical_features_with_missing_values_test
                  )
              )
          )
  
      if self._is_added:
          warnings.warn(
              (
                  "DUPLICATE-EXPLAINER-CONFIG: Ignoring. "
                  "Explanation has already been added, "
                  "currently limited to one explainer type."
              ),
              UserWarning,
          )
          return
  
      self._initialize_surrogate_model()
      self._is_added = True
  
imports: import json
  import warnings
  from pathlib import Path
  from typing import Any, List, Optional
  import numpy
  import pandas
  from interpret_community.explanation.explanation import FeatureImportanceExplanation, load_explanation, save_explanation
  from interpret_community.mimic.mimic_explainer import MimicExplainer
  from interpret_community.mimic.models.lightgbm_model import LGBMExplainableModel
  from interpret_community.mimic.models.linear_model import LinearExplainableModel
  from scipy.sparse import issparse
  from raiutils.data_processing import convert_to_list
  from raiutils.exceptions import UserConfigValidationException
  from raiutils.models import ModelTask
  from responsibleai._interfaces import EBMGlobalExplanation, FeatureImportance, ModelExplanationData, PrecomputedExplanations
  from responsibleai._internal.constants import ExplainerManagerKeys
  from responsibleai._internal.constants import ExplanationKeys, ListProperties, ManagerNames, Metadata
  from responsibleai._tools.shared.state_directory_management import DirectoryManager
  from responsibleai.managers.base_manager import BaseManager
  from responsibleai.utils import _find_features_having_missing_values, _measure_time
label_desc: Use image node_id 2 for calling the ExplainerManager obj's underlying member method code with example usage: obj.add() without return types