class_docstr: Implementation of the Attribution Localization by Kohlbrenner et al., 2020.
  
  Attribution Localization implements the ratio of positive attributions within the target to the overall
  attribution. High scores are desired, as it means, that the positively attributed pixels belong to the
  targeted object class.
  
  References:
      1) Max Kohlbrenner et al., "Towards Best Practice in Explaining Neural Network Decisions with LRP."
         IJCNN (2020): 1-7.
  
  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","the","Attribution","Localization","by","Kohlbrenner","et","al.",",","2020",".","Attribution","Localization","implements","the","ratio","of","positive","attributions","within","the","target","to","the","overall","attribution",".","High","scores","are","desired",",","as","it","means",",","that","the","positively","attributed","pixels","belong","to","the","targeted","object","class",".","References",":","1",")","Max","Kohlbrenner","et","al.",",","``","Towards","Best","Practice","in","Explaining","Neural","Network","Decisions","with","LRP",".","''","IJCNN","(","2020",")",":","1-7",".","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: Parameters
  ----------
  weighted: boolean
      Indicates whether the weighted variant of the inside-total relevance ratio is used,
      default=False.
  max_size: float
      The maximum ratio for  the size of the bounding box to image, default=1.0.
  abs: boolean
      Indicates whether absolute operation is applied on the attribution, default=True.
  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={}.
  return_aggregate: boolean
      Indicates if an aggregated score should be computed over all instances.
  aggregate_func: callable
      Callable that aggregates the scores given an evaluation call.
  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","--","--","--","--","--","weighted",":","boolean","Indicates","whether","the","weighted","variant","of","the","inside-total","relevance","ratio","is","used",",","default=False",".","max_size",":","float","The","maximum","ratio","for","the","size","of","the","bounding","box","to","image",",","default=1.0",".","abs",":","boolean","Indicates","whether","absolute","operation","is","applied","on","the","attribution",",","default=True",".","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=","{","}",".","return_aggregate",":","boolean","Indicates","if","an","aggregated","score","should","be","computed","over","all","instances",".","aggregate_func",":","callable","Callable","that","aggregates","the","scores","given","an","evaluation","call",".","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,
      weighted: bool = False,
      max_size: float = 1.0,
      abs: bool = True,
      normalise: bool = True,
      normalise_func: Optional[Callable] = None,
      normalise_func_kwargs: Optional[Dict] = None,
      return_aggregate: bool = False,
      aggregate_func: Optional[Callable] = None,
      default_plot_func: Optional[Callable] = None,
      display_progressbar: bool = False,
      disable_warnings: bool = False,
      **kwargs,
  ):
      """
      Parameters
      ----------
      weighted: boolean
          Indicates whether the weighted variant of the inside-total relevance ratio is used,
          default=False.
      max_size: float
          The maximum ratio for  the size of the bounding box to image, default=1.0.
      abs: boolean
          Indicates whether absolute operation is applied on the attribution, default=True.
      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={}.
      return_aggregate: boolean
          Indicates if an aggregated score should be computed over all instances.
      aggregate_func: callable
          Callable that aggregates the scores given an evaluation call.
      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.
      """
  
      if not abs:
          warn.warn_absolute_operation()
  
      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,
      )
  
      # Save metric-specific attributes.
      self.weighted = weighted
      self.max_size = max_size
      if not self.disable_warnings:
          warn.warn_parameterisation(
              metric_name=self.__class__.__name__,
              sensitive_params=(
                  "ground truth mask i.e., the 's_batch', if size of the ground truth "
                  "mask is taking into account 'weighted' as well as if attributions"
                  " are normalised 'normalise' (and 'normalise_func') and/ or taking "
                  "the absolute values of such 'abs'"
              ),
              citation=(
                  "Kohlbrenner M., Bauer A., Nakajima S., Binder A., Wojciech S., Lapuschkin S. "
                  "'Towards Best Practice in Explaining Neural Network Decisions with LRP."
                  "arXiv preprint arXiv:1910.09840v2 (2020)."
              ),
          )
  
file_path: Quantus/quantus/metrics/localisation/attribution_localisation.py
imports: import sys
  from typing import Callable, Dict, List, Optional
  import numpy
  from quantus.helpers import asserts, warn
  from quantus.helpers.enums import DataType, EvaluationCategory, ModelType, ScoreDirection
  from quantus.metrics.base import Metric
label_desc: Use image node_id 1 to create a new AttributionLocalisation object from inherited base classes: Metric with example: obj = AttributionLocalisation(weighted, max_size, abs, normalise, normalise_func, normalise_func_kwargs, return_aggregate, aggregate_func, default_plot_func, display_progressbar, disable_warnings)