class_docstr: Implementation of Completeness test by Sundararajan et al., 2017, also referred
  to as Summation to Delta by Shrikumar et al., 2017 and Conservation by
  Montavon et al., 2018.
  
  Attribution completeness asks that the total attribution is proportional to the explainable
  evidence at the output/ or some function of the model output. Or, that the attributions
  add up to the difference between the model output F at the input x and the baseline b.
  
  Assumptions:
      - This implementation does completeness test against logits, not softmax.
  
  References:
      1) Completeness - Mukund Sundararajan et al.: "Axiomatic attribution for deep networks."
      International Conference on Machine Learning. PMLR, 2017.
      2) Summation to delta - Avanti Shrikumar et al.: "Learning important
      features through propagating activation differences." International Conference on Machine Learning. PMLR, 2017.
      3) Conservation - 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.
docstr: Parameters
  ----------
  abs: boolean
      Indicates whether absolute operation is applied on the attribution, default=False.
  normalise: boolean
      Indicates whether normalise operation is applied on the attribution, default=True.
  normalise_func: callable
      Attribution normalisation function applied in case normalise=True.
          If normalise_func=None, the default value is used, default=normalise_by_max.
  normalise_func_kwargs: dict
      Keyword arguments to be passed to normalise_func on call, default={}.
  output_func: callable
      Function applied to the difference between the model output at the input and the
          baseline before metric calculation. If output_func=None, the default value is used, default=lambda x: x.
  perturb_baseline: string
      Indicates the type of baseline: "mean", "random", "uniform", "black" or "white",
          default="black".
  perturb_func: callable
      Input perturbation function. If None, the default value is used,
          default=baseline_replacement_by_indices.
  perturb_func_kwargs: dict
      Keyword arguments to be passed to perturb_func, default={}.
  softmax: boolean
      Indicates whether to use softmax probabilities or logits in model prediction, default=False.
  return_aggregate: boolean
      Indicates if an aggregated score should be produced over all instances.
  aggregate_func: callable
      A Callable to aggregate the scores per instance to one float.
  default_plot_func: callable
      Callable that plots the metrics result.
  disable_warnings: boolean
      Indicates whether the warnings are printed, default=False.
  display_progressbar: boolean
      Indicates whether a tqdm-progress-bar is printed, default=False.
  kwargs: optional
      Keyword arguments.
docstr_tok: ["Parameters","--","--","--","--","--","abs",":","boolean","Indicates","whether","absolute","operation","is","applied","on","the","attribution",",","default=False",".","normalise",":","boolean","Indicates","whether","normalise","operation","is","applied","on","the","attribution",",","default=True",".","normalise_func",":","callable","Attribution","normalisation","function","applied","in","case","normalise=True",".","If","normalise_func=None",",","the","default","value","is","used",",","default=normalise_by_max",".","normalise_func_kwargs",":","dict","Keyword","arguments","to","be","passed","to","normalise_func","on","call",",","default=","{","}",".","output_func",":","callable","Function","applied","to","the","difference","between","the","model","output","at","the","input","and","the","baseline","before","metric","calculation",".","If","output_func=None",",","the","default","value","is","used",",","default=lambda","x",":","x.","perturb_baseline",":","string","Indicates","the","type","of","baseline",":","``","mean","''",",","``","random","''",",","``","uniform","''",",","``","black","''","or","``","white","''",",","default=","''","black","''",".","perturb_func",":","callable","Input","perturbation","function",".","If","None",",","the","default","value","is","used",",","default=baseline_replacement_by_indices",".","perturb_func_kwargs",":","dict","Keyword","arguments","to","be","passed","to","perturb_func",",","default=","{","}",".","softmax",":","boolean","Indicates","whether","to","use","softmax","probabilities","or","logits","in","model","prediction",",","default=False",".","return_aggregate",":","boolean","Indicates","if","an","aggregated","score","should","be","produced","over","all","instances",".","aggregate_func",":","callable","A","Callable","to","aggregate","the","scores","per","instance","to","one","float",".","default_plot_func",":","callable","Callable","that","plots","the","metrics","result",".","disable_warnings",":","boolean","Indicates","whether","the","warnings","are","printed",",","default=False",".","display_progressbar",":","boolean","Indicates","whether","a","tqdm-progress-bar","is","printed",",","default=False",".","kwargs",":","optional","Keyword","arguments","."]
code: def __init__(
      self,
      abs: bool = False,
      normalise: bool = True,
      normalise_func: Optional[
          Callable[[np.ndarray], np.ndarray]
      ] = None,
      normalise_func_kwargs: Optional[Dict[str, Any]] = None,
      output_func: Optional[Callable] = None,
      perturb_baseline: str = "black",
      perturb_func: Optional[Callable] = None,
      perturb_func_kwargs: Optional[Dict[str, Any]] = None,
      return_aggregate: bool = False,
      aggregate_func: Optional[Callable] = None,
      default_plot_func: Optional[Callable] = None,
      disable_warnings: bool = False,
      display_progressbar: bool = False,
      **kwargs,
  ):
      """
      Parameters
      ----------
      abs: boolean
          Indicates whether absolute operation is applied on the attribution, default=False.
      normalise: boolean
          Indicates whether normalise operation is applied on the attribution, default=True.
      normalise_func: callable
          Attribution normalisation function applied in case normalise=True.
              If normalise_func=None, the default value is used, default=normalise_by_max.
      normalise_func_kwargs: dict
          Keyword arguments to be passed to normalise_func on call, default={}.
      output_func: callable
          Function applied to the difference between the model output at the input and the
              baseline before metric calculation. If output_func=None, the default value is used, default=lambda x: x.
      perturb_baseline: string
          Indicates the type of baseline: "mean", "random", "uniform", "black" or "white",
              default="black".
      perturb_func: callable
          Input perturbation function. If None, the default value is used,
              default=baseline_replacement_by_indices.
      perturb_func_kwargs: dict
          Keyword arguments to be passed to perturb_func, default={}.
      softmax: boolean
          Indicates whether to use softmax probabilities or logits in model prediction, default=False.
      return_aggregate: boolean
          Indicates if an aggregated score should be produced over all instances.
      aggregate_func: callable
          A Callable to aggregate the scores per instance to one float.
      default_plot_func: callable
          Callable that plots the metrics result.
      disable_warnings: boolean
          Indicates whether the warnings are printed, default=False.
      display_progressbar: boolean
          Indicates whether a tqdm-progress-bar is printed, default=False.
      kwargs: optional
          Keyword arguments.
      """
      super().__init__(
          abs=abs,
          normalise=normalise,
          normalise_func=normalise_func,
          normalise_func_kwargs=normalise_func_kwargs,
          return_aggregate=return_aggregate,
          aggregate_func=aggregate_func,
          default_plot_func=default_plot_func,
          display_progressbar=display_progressbar,
          disable_warnings=disable_warnings,
          **kwargs,
      )
      if perturb_func is None:
          perturb_func = baseline_replacement_by_indices
  
      # Save metric-specific attributes.
      if output_func is None:
          output_func = identity
      self.output_func = output_func
      self.perturb_func = make_perturb_func(
          perturb_func,
          perturb_func_kwargs,
          perturb_baseline=perturb_baseline,
      )
  
      # Asserts and warnings.
      if not self.disable_warnings:
          warn.warn_parameterisation(
              metric_name=self.__class__.__name__,
              sensitive_params=(
                  "baseline value 'perturb_baseline' and the function to modify the "
                  "model response 'output_func'"
              ),
              citation=(
                  "Sundararajan, Mukund, Ankur Taly, and Qiqi Yan. 'Axiomatic attribution for "
                  "deep networks.' International Conference on Machine Learning. PMLR, (2017)."
              ),
          )
  
file_path: Quantus/quantus/metrics/axiomatic/completeness.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 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
  from quantus.helpers.utils import identity
label_desc: Use image node_id 1 to create a new Completeness object from inherited base classes: Metric with example: obj = Completeness(abs, normalise, normalise_func, normalise_func_kwargs, output_func, perturb_baseline, perturb_func, perturb_func_kwargs, return_aggregate, aggregate_func, default_plot_func, disable_warnings, display_progressbar)