class_docstr: Implementation of the Pointing Game by Zhang et al., 2018.
  
  The Pointing Game implements a check whether the point of maximal attribution is on target,
  denoted by a binary mask. High scores are desired as it means, that the maximal attributed pixel belongs to
  an object of the specified class.
  
  References:
      1) Jianming Zhang et al.:
         "Top-Down Neural Attention by Excitation Backprop." International Journal of Computer Vision
         (2018) 126:1084-1102.
  
  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.
class_docstr_tok: ["Implementation","of","the","Pointing","Game","by","Zhang","et","al.",",","2018",".","The","Pointing","Game","implements","a","check","whether","the","point","of","maximal","attribution","is","on","target",",","denoted","by","a","binary","mask",".","High","scores","are","desired","as","it","means",",","that","the","maximal","attributed","pixel","belongs","to","an","object","of","the","specified","class",".","References",":","1",")","Jianming","Zhang","et","al",".",":","``","Top-Down","Neural","Attention","by","Excitation","Backprop",".","''","International","Journal","of","Computer","Vision","(","2018",")","126:1084-1102",".","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: Evaluate instance gets model and data for a single instance as input and returns the evaluation result.
  
  Parameters
  ----------
  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
  -------
  boolean
      The evaluation results.
docstr_tok: ["Evaluate","instance","gets","model","and","data","for","a","single","instance","as","input","and","returns","the","evaluation","result",".","Parameters","--","--","--","--","--","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","--","--","--","-","boolean","The","evaluation","results","."]
code: def evaluate_instance(
      self,
      a: np.ndarray,
      s: np.ndarray,
  ) -> float:
      """
      Evaluate instance gets model and data for a single instance as input and returns the evaluation result.
  
      Parameters
      ----------
      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
      -------
      boolean
          The evaluation results.
      """
  
      # Return np.nan as result if segmentation map is empty.
      if np.sum(s) == 0:
          warn.warn_empty_segmentation()
          return np.nan
  
      # Prepare shapes.
      a = a.flatten()
      s = s.flatten().astype(bool)
  
      # Find indices with max value.
      max_index = np.argwhere(a == np.max(a))
  
      # Check if maximum of explanation is on target object class.
      hit = np.any(s[max_index])
  
      if self.weighted and hit:
          hit = 1 - (np.sum(s) / float(np.prod(s.shape)))
  
      return hit
  
file_path: Quantus/quantus/metrics/localisation/pointing_game.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 3 for calling the PointingGame obj's underlying member method code with example usage: obj.evaluate_instance(a, s) and returns: hit, np