class_docstr: Implementation of NonSensitivity by Nguyen at el., 2020.
  
  Non-sensitivity measures if zero-importance is only assigned to features, that the model is not
  functionally dependent on.
  
  References:
      1) An-phi Nguyen and María Rodríguez Martínez.: "On quantitative aspects of model
      interpretability." arXiv preprint arXiv:2007.07584 (2020).
      2) Marco Ancona et al.: "Explaining Deep Neural Networks with a Polynomial Time Algorithm for Shapley
      Values Approximation." ICML (2019): 272-281.
      3) Grégoire Montavon et al.: "Methods for interpreting and
      understanding deep neural networks." Digital Signal Processing 73 (2018): 1-15.
  
  Attributes:
      -  _name: The name of the metric.
      - _data_applicability: The data types that the metric implementation currently supports.
      - _models: The model types that this metric can work with.
      - score_direction: How to interpret the scores, whether higher/ lower values are considered better.
      - evaluation_category: What property/ explanation quality that this metric measures.
docstr: Evaluate instance gets model and data for a single instance as input and returns the evaluation result.
  
  Parameters
  ----------
  model: ModelInterface
      A ModelInteface that is subject to explanation.
  x: np.ndarray
      The input to be evaluated on an instance-basis.
  y: np.ndarray
      The output to be evaluated on an instance-basis.
  a: np.ndarray
      The explanation to be evaluated on an instance-basis.
  s: np.ndarray
      The segmentation to be evaluated on an instance-basis.
  
  Returns
  -------
  integer:
      The evaluation results.
docstr_tok: ["Evaluate","instance","gets","model","and","data","for","a","single","instance","as","input","and","returns","the","evaluation","result",".","Parameters","--","--","--","--","--","model",":","ModelInterface","A","ModelInteface","that","is","subject","to","explanation",".","x",":","np.ndarray","The","input","to","be","evaluated","on","an","instance-basis",".","y",":","np.ndarray","The","output","to","be","evaluated","on","an","instance-basis",".","a",":","np.ndarray","The","explanation","to","be","evaluated","on","an","instance-basis",".","s",":","np.ndarray","The","segmentation","to","be","evaluated","on","an","instance-basis",".","Returns","--","--","--","-","integer",":","The","evaluation","results","."]
code: def evaluate_instance(
      self,
      model: ModelInterface,
      x: np.ndarray,
      y: np.ndarray,
      a: np.ndarray,
  ) -> int:
      """
      Evaluate instance gets model and data for a single instance as input and returns the evaluation result.
  
      Parameters
      ----------
      model: ModelInterface
          A ModelInteface that is subject to explanation.
      x: np.ndarray
          The input to be evaluated on an instance-basis.
      y: np.ndarray
          The output to be evaluated on an instance-basis.
      a: np.ndarray
          The explanation to be evaluated on an instance-basis.
      s: np.ndarray
          The segmentation to be evaluated on an instance-basis.
  
      Returns
      -------
      integer:
          The evaluation results.
      """
      a = a.flatten()
  
      non_features = set(list(np.argwhere(a).flatten() < self.eps))
  
      vars = []
      for i_ix, a_ix in enumerate(a[:: self.features_in_step]):
          preds = []
          a_ix = a[
              (self.features_in_step * i_ix) : (
                  self.features_in_step * (i_ix + 1)
              )
          ].astype(int)
  
          for _ in range(self.n_samples):
              # Perturb input by indices of attributions.
              x_perturbed = self.perturb_func(
                  arr=x,
                  indices=a_ix,
                  indexed_axes=self.a_axes,
              )
  
              # Predict on perturbed input x.
              x_input = model.shape_input(
                  x_perturbed, x.shape, channel_first=True
              )
              y_pred_perturbed = float(model.predict(x_input)[:, y])
  
              preds.append(y_pred_perturbed)
              vars.append(np.var(preds))
  
      non_features_vars = set(
          list(np.argwhere(vars).flatten() < self.eps)
      )
  
      return len(non_features_vars.symmetric_difference(non_features))
  
file_path: Quantus/quantus/metrics/axiomatic/non_sensitivity.py
imports: import sys
  from typing import Any, Callable, Dict, List, Optional
  import numpy
  from quantus.functions.perturb_func import baseline_replacement_by_indices
  from quantus.helpers import asserts, warn
  from quantus.helpers.enums import DataType, EvaluationCategory, ModelType, ScoreDirection
  from quantus.helpers.model.model_interface import ModelInterface
  from quantus.helpers.perturbation_utils import make_perturb_func
  from quantus.metrics.base import Metric
label_desc: Use image node_id 3 for calling the NonSensitivity obj's underlying member method code with example usage: obj.evaluate_instance(model, x, y, a) and returns: len