class_docstr: Class for model interpreter
  
  This class is to help to interpret the model with a model-agnostic explainer.
docstr: Get statistics of explanations generated by the pre-defined explainer from given samples
  
  Args:
      class_num: int, number of classes
      samples: list[numpy.ndarray], not None. A list of 1D numpy array corresponding to row/single examples
      stats_type: str, not None. The pre-defined stats_type for statistical analysis.
                  For details see `xai.model_interpreter.explanation_aggregator.get_statistics()`
      k:  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.
  
  Returns:
      A dictionary maps class label to the aggregated feature importance score.
docstr_tok: ["Get","statistics","of","explanations","generated","by","the","pre-defined","explainer","from","given","samples","Args",":","class_num",":","int",",","number","of","classes","samples",":","list","[","numpy.ndarray","]",",","not","None",".","A","list","of","1D","numpy","array","corresponding","to","row\/single","examples","stats_type",":","str",",","not","None",".","The","pre-defined","stats_type","for","statistical","analysis",".","For","details","see","`","xai.model_interpreter.explanation_aggregator.get_statistics","(",")","`","k",":","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",".","Returns",":","A","dictionary","maps","class","label","to","the","aggregated","feature","importance","score","."]
code: def interpret_model(
      self,
      samples: List[numpy.ndarray],
      stats_type: str = "top_k",
      k: int = 5,
  ):
      """
      Get statistics of explanations generated by the pre-defined explainer from given samples
  
      Args:
          class_num: int, number of classes
          samples: list[numpy.ndarray], not None. A list of 1D numpy array corresponding to row/single examples
          stats_type: str, not None. The pre-defined stats_type for statistical analysis.
                      For details see `xai.model_interpreter.explanation_aggregator.get_statistics()`
          k:  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.
  
      Returns:
          A dictionary maps class label to the aggregated feature importance score.
  
      """
      if self._explainer:
          _explainer_aggregator = ExplanationAggregator(
              confidence_threshold=0.8
          )
  
          for idx, sample in enumerate(samples):
              exp = self._explainer.explain_instance(
                  instance=sample,
                  top_labels=1,
                  num_samples=max(len(samples) // 10, 100),
                  num_features=k,
              )
              _explainer_aggregator.feed(explanation=exp)
              if (idx + 1) % 100 == 0:
                  warnings.warn(
                      message="Interpret %s/%s samples"
                      % (idx + 1, len(samples))
                  )
          return _explainer_aggregator.get_statistics(
              stats_type=stats_type, k=k
          )
      else:
          raise InterpreterUninitializedError(
              "This interpreter is not yet instantiated! "
              "Please call build_interpreter()"
              "first before interpreting models."
          )
  
file_path: contextual-ai/xai/model/interpreter/model_interpreter.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import operator
  import warnings
  import numpy
  from typing import List, Union, Dict, Tuple
  from xai.explainer.explainer_factory import ExplainerFactory
  from xai.explainer.constants import OUTPUT
  from xai.model.interpreter.exceptions import InterpreterUninitializedError
  from xai.model.interpreter.explanation_aggregator import ExplanationAggregator
label_desc: Use image node_id 3 for calling the ModelInterpreter obj's underlying member method code with example usage: obj.interpret_model(samples, stats_type, k) and returns: _explainer_aggregator