code: def get_classification_reward(Y_pred: np.ndarray, Y_true: np.ndarray):
      """
      Computes classification reward per instance given the prediction output and the true label. The classification
      reward is a sparse/binary reward: 1 if the most likely classes from the prediction output and the label match,
      0 otherwise.
  
      Parameters
      ----------
      Y_pred
          Prediction output as a distribution over the possible classes.
      Y_true
          True label as a distribution over the possible classes.
  
      Returns
      -------
      Classification reward per instance. 1 if the most likely classes match, 0 otherwise.
      """
      if len(Y_pred.shape) != 2:
          raise ValueError(
              "Prediction labels should be a 2D array for classification task."
          )
  
      if len(Y_true.shape) != 2:
          raise ValueError(
              "Target labels should be a 2D array for classification task."
          )
  
      Y_pred = np.argmax(Y_pred, axis=1)
      Y_true = np.argmax(Y_true, axis=1)
      return Y_pred == Y_true
  
file_path: alibi/alibi/explainers/backends/cfrl_base.py
imports: import numpy
  from typing import Callable, Any, Optional
  from abc import ABC, abstractmethod
label_desc: Use image node_id 3 for calling a global function with example usage: get_classification_reward(Y_pred, Y_true) and returns: unknown