class_docstr: Implementation of Focus evaluation strategy by Arias et. al. 2022
  
  The Focus is computed through mosaics of instances from different classes, and the explanations these generate.
  Each mosaic contains four images: two images belonging to the target class (the specific class the feature
  attribution method is expected to explain) and the other two are chosen randomly from the rest of classes.
  Thus, the Focus estimates the reliability of feature attribution method’s output as the probability of the sampled
  pixels lying on an image of the target class of the mosaic. This is equivalent to the proportion
  of positive relevance lying on those images.
  
  References:
      1) Anna Arias-Duart et al.: "Focus! Rating XAI Methods
      and Finding Biases" FUZZ-IEEE (2022): 1-8.
  
  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","Focus","evaluation","strategy","by","Arias","et",".","al",".","2022","The","Focus","is","computed","through","mosaics","of","instances","from","different","classes",",","and","the","explanations","these","generate",".","Each","mosaic","contains","four","images",":","two","images","belonging","to","the","target","class","(","the","specific","class","the","feature","attribution","method","is","expected","to","explain",")","and","the","other","two","are","chosen","randomly","from","the","rest","of","classes",".","Thus",",","the","Focus","estimates","the","reliability","of","feature","attribution","method","\u2019","s","output","as","the","probability","of","the","sampled","pixels","lying","on","an","image","of","the","target","class","of","the","mosaic",".","This","is","equivalent","to","the","proportion","of","positive","relevance","lying","on","those","images",".","References",":","1",")","Anna","Arias-Duart","et","al",".",":","``","Focus","!","Rating","XAI","Methods","and","Finding","Biases","''","FUZZ-IEEE","(","2022",")",":","1-8",".","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: 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.
  c: any
      The custom input to be evaluated on an instance-basis.
  
  Returns
  -------
  float
      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",".","c",":","any","The","custom","input","to","be","evaluated","on","an","instance-basis",".","Returns","--","--","--","-","float","The","evaluation","results","."]
code: def evaluate_instance(
      self,
      a: np.ndarray,
      c: 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.
      c: any
          The custom input to be evaluated on an instance-basis.
  
      Returns
      -------
      float
          The evaluation results.
      """
  
      # Prepare shapes for mosaics.
      self.mosaic_shape = a.shape
  
      total_positive_relevance = np.sum(a[a > 0], dtype=np.float64)
      target_positive_relevance = 0
  
      quadrant_functions_list = [
          self.quadrant_top_left,
          self.quadrant_top_right,
          self.quadrant_bottom_left,
          self.quadrant_bottom_right,
      ]
  
      for quadrant_p, quadrant_func in zip(c, quadrant_functions_list):
          if not bool(quadrant_p):
              continue
          quadrant_relevance = quadrant_func(a=a)
          target_positive_relevance += np.sum(
              quadrant_relevance[quadrant_relevance > 0]
          )
  
      focus_score = target_positive_relevance / total_positive_relevance
  
      return focus_score
  
file_path: Quantus/quantus/metrics/localisation/focus.py
imports: import sys
  from typing import Any, Callable, Dict, List, Optional
  import numpy
  from quantus.helpers import plotting, warn
  from quantus.helpers.enums import DataType, EvaluationCategory, ModelType, ScoreDirection
  from quantus.helpers.model.model_interface import ModelInterface
  from quantus.metrics.base import Metric
label_desc: Use image node_id 3 for calling the Focus obj's underlying member method code with example usage: obj.evaluate_instance(a, c) and returns: focus_score