class_docstr: Implementation of the top-k intersection by Theiner et al., 2021.
  
  The TopKIntersection implements the pixel-wise intersection between a ground truth target object mask and
  an "explainer" mask, the binarized version of the explanation. High scores are desired, as the
  overlap between the ground truth object mask and the attribution mask should be maximal.
  
  References:
      1) Jonas Theiner et al.: "Interpretable Semantic Photo
      Geolocalization." arXiv preprint arXiv:2104.14995 (2021).
  
  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","top-k","intersection","by","Theiner","et","al.",",","2021",".","The","TopKIntersection","implements","the","pixel-wise","intersection","between","a","ground","truth","target","object","mask","and","an","``","explainer","''","mask",",","the","binarized","version","of","the","explanation",".","High","scores","are","desired",",","as","the","overlap","between","the","ground","truth","object","mask","and","the","attribution","mask","should","be","maximal",".","References",":","1",")","Jonas","Theiner","et","al",".",":","``","Interpretable","Semantic","Photo","Geolocalization",".","''","arXiv","preprint","arXiv:2104.14995","(","2021",")",".","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
  ----------
  k: integer
      Top k attributions values to use, default=1000.
  concept_influence: boolean
      Indicates whether concept influence metric is used, default=False.
  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={}.
  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","--","--","--","--","--","k",":","integer","Top","k","attributions","values","to","use",",","default=1000",".","concept_influence",":","boolean","Indicates","whether","concept","influence","metric","is","used",",","default=False",".","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=","{","}",".","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,
      k: int = 1000,
      concept_influence: bool = False,
      abs: bool = False,
      normalise: bool = True,
      normalise_func: Optional[
          Callable[[np.ndarray], np.ndarray]
      ] = None,
      normalise_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
      ----------
      k: integer
          Top k attributions values to use, default=1000.
      concept_influence: boolean
          Indicates whether concept influence metric is used, default=False.
      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={}.
      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.
      """
  
      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.k = k
      self.concept_influence = concept_influence
  
      # Asserts and warnings.
      if not self.disable_warnings:
          warn.warn_parameterisation(
              metric_name=self.__class__.__name__,
              sensitive_params=(
                  "ground truth mask i.e., the 's_batch', the number of features to "
                  "consider 'k', if size of the ground truth mask is taking into account"
                  " 'concept_influence' as well as if attributions are normalised "
                  "'normalise' (and 'normalise_func') and/ or taking absolute values "
                  "of such 'abs'"
              ),
              citation=(
                  "Theiner, Jonas, Müller-Budack Eric, and Ewerth, Ralph. 'Interpretable "
                  "Semantic Photo Geolocalization.' arXiv preprint arXiv:2104.14995 (2021)"
              ),
          )
  
file_path: Quantus/quantus/metrics/localisation/top_k_intersection.py
imports: import sys
  from typing import Any, 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 TopKIntersection object from inherited base classes: Metric with example: obj = TopKIntersection(k, concept_influence, abs, normalise, normalise_func, normalise_func_kwargs, return_aggregate, aggregate_func, default_plot_func, disable_warnings, display_progressbar)