class_docstr: Implementation of Complexity metric by Bhatt et al., 2020.
  
  Complexity of attributions is defined as the entropy of the fractional contribution of feature x_i to the total
  magnitude of the attribution. A complex explanation is one that uses all features in its explanation to explain
  some decision. Even though such an explanation may be faithful to the model output, if the number of features is
  too large it may be too difficult for the user to understand the explanations, rendering it useless.
  
  References:
      1) Umang Bhatt et al.: "Evaluating and aggregating
      feature-based model explanations." IJCAI (2020): 3016-3022.
  
  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","Complexity","metric","by","Bhatt","et","al.",",","2020",".","Complexity","of","attributions","is","defined","as","the","entropy","of","the","fractional","contribution","of","feature","x_i","to","the","total","magnitude","of","the","attribution",".","A","complex","explanation","is","one","that","uses","all","features","in","its","explanation","to","explain","some","decision",".","Even","though","such","an","explanation","may","be","faithful","to","the","model","output",",","if","the","number","of","features","is","too","large","it","may","be","too","difficult","for","the","user","to","understand","the","explanations",",","rendering","it","useless",".","References",":","1",")","Umang","Bhatt","et","al",".",":","``","Evaluating","and","aggregating","feature-based","model","explanations",".","''","IJCAI","(","2020",")",":","3016-3022",".","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
  ----------
  x: np.ndarray
      The input to be evaluated on an instance-basis.
  a: np.ndarray
      The explanation 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","--","--","--","--","--","x",":","np.ndarray","The","input","to","be","evaluated","on","an","instance-basis",".","a",":","np.ndarray","The","explanation","to","be","evaluated","on","an","instance-basis",".","Returns","--","--","--","-","float","The","evaluation","results","."]
code: def evaluate_instance(x: np.ndarray, a: np.ndarray) -> float:
      """
      Evaluate instance gets model and data for a single instance as input and returns the evaluation result.
  
      Parameters
      ----------
      x: np.ndarray
          The input to be evaluated on an instance-basis.
      a: np.ndarray
          The explanation to be evaluated on an instance-basis.
  
      Returns
      -------
      float
          The evaluation results.
      """
  
      if len(x.shape) == 1:
          newshape = np.prod(x.shape)
      else:
          newshape = np.prod(x.shape[1:])
  
      a = np.array(np.reshape(a, newshape), dtype=np.float64) / np.sum(
          np.abs(a)
      )
      return scipy.stats.entropy(pk=a)
  
file_path: Quantus/quantus/metrics/complexity/complexity.py
imports: import sys
  from typing import Any, Callable, Dict, List, Optional
  import numpy
  import scipy
  from quantus.helpers import 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 Complexity obj's underlying member method code with example usage: obj.evaluate_instance(x, a) and returns: scipy