class_docstr: Implementation of Sufficiency test by Dasgupta et al., 2022.
  
  The (global) sufficiency metric measures the expected local sufficiency. Local sufficiency measures the probability
  of the prediction label for a given datapoint coinciding with the prediction labels of other data points that the
  same explanation applies to. For example, if the explanation of a given image is "contains zebra", the local
  sufficiency metric measures the probability a different that contains zebra having the same prediction label.
  
  Assumptions:
      - We assume that a given explanation applies to 'anothers' data point if the distance between
      the explanation and the explanations of the data point is under the user-defined threshold.
  
  References:
       1) Sanjoy Dasgupta et al.: "Framework for Evaluating Faithfulness of Local
          Explanations." ICML (2022): 4794-4815.
  
  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.
class_docstr_tok: ["Implementation","of","Sufficiency","test","by","Dasgupta","et","al.",",","2022",".","The","(","global",")","sufficiency","metric","measures","the","expected","local","sufficiency",".","Local","sufficiency","measures","the","probability","of","the","prediction","label","for","a","given","datapoint","coinciding","with","the","prediction","labels","of","other","data","points","that","the","same","explanation","applies","to",".","For","example",",","if","the","explanation","of","a","given","image","is","``","contains","zebra","''",",","the","local","sufficiency","metric","measures","the","probability","a","different","that","contains","zebra","having","the","same","prediction","label",".","Assumptions",":","-","We","assume","that","a","given","explanation","applies","to","'anothers","'","data","point","if","the","distance","between","the","explanation","and","the","explanations","of","the","data","point","is","under","the","user-defined","threshold",".","References",":","1",")","Sanjoy","Dasgupta","et","al",".",":","``","Framework","for","Evaluating","Faithfulness","of","Local","Explanations",".","''","ICML","(","2022",")",":","4794-4815",".","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: This method performs XAI evaluation on a single batch of explanations.
  For more information on the specific logic, we refer the metric’s initialisation docstring.
  
  Parameters
  ----------
  i_batch:
      The index of the current instance.
  a_sim_vector_batch:
      The custom input to be evaluated on an instance-basis.
  y_pred_classes:
      The class predictions of the complete input dataset.
  kwargs:
      Unused.
  
  Returns
  -------
  evaluation_scores:
      List of measured sufficiency for each entry in the batch.
docstr_tok: ["This","method","performs","XAI","evaluation","on","a","single","batch","of","explanations",".","For","more","information","on","the","specific","logic",",","we","refer","the","metric","\u2019","s","initialisation","docstring",".","Parameters","--","--","--","--","--","i_batch",":","The","index","of","the","current","instance",".","a_sim_vector_batch",":","The","custom","input","to","be","evaluated","on","an","instance-basis",".","y_pred_classes",":","The","class","predictions","of","the","complete","input","dataset",".","kwargs",":","Unused",".","Returns","--","--","--","-","evaluation_scores",":","List","of","measured","sufficiency","for","each","entry","in","the","batch","."]
code: def evaluate_batch(
      self,
      i_batch: np.ndarray,
      a_sim_vector_batch: np.ndarray,
      y_pred_classes: np.ndarray,
      **kwargs,
  ) -> List[float]:
      """
      This method performs XAI evaluation on a single batch of explanations.
      For more information on the specific logic, we refer the metric’s initialisation docstring.
  
      Parameters
      ----------
      i_batch:
          The index of the current instance.
      a_sim_vector_batch:
          The custom input to be evaluated on an instance-basis.
      y_pred_classes:
          The class predictions of the complete input dataset.
      kwargs:
          Unused.
  
      Returns
      -------
      evaluation_scores:
          List of measured sufficiency for each entry in the batch.
      """
  
      return [
          self.evaluate_instance(
              i=i,
              a_sim_vector=a_sim_vector,
              y_pred_classes=y_pred_classes,
          )
          for i, a_sim_vector in zip(i_batch, a_sim_vector_batch)
      ]
  
file_path: Quantus/quantus/metrics/faithfulness/sufficiency.py
imports: import sys
  from typing import Any, Callable, Dict, List, Optional, no_type_check
  import numpy
  from scipy.spatial.distance import cdist
  from quantus.helpers.model.model_interface import ModelInterface
  from quantus.helpers import warn
  from quantus.helpers.enums import DataType, EvaluationCategory, ModelType, ScoreDirection
  from quantus.metrics.base import Metric
label_desc: Use image node_id 5 for calling the Sufficiency obj's underlying member method code with example usage: obj.evaluate_batch(i_batch, a_sim_vector_batch, y_pred_classes) and returns: unknown