docstr: Checks that the maximum predicted score lies in the desired class.
docstr_tok: ["Checks","that","the","maximum","predicted","score","lies","in","the","desired","class","."]
code: def _predict_fn_custom(self, input_instance, desired_class):
      """Checks that the maximum predicted score lies in the desired class."""
      """The reason we do so can be illustrated by
          this example: If the predict probabilities are [0, 0.5, 0,5], the computed yloss is 0 as class 2 has the same
          value as the maximum score. sklearn's usual predict function, which implements argmax, returns class 1 instead
          of 2. This is why we need a custom predict function that returns the desired class if the maximum predict
          probability is the same as the probability of the desired class."""
  
      input_instance = self.label_decode(input_instance)
      output = self.model.get_output(input_instance, model_score=True)
      if (
          self.model.model_type == ModelTypes.Classifier
          and np.array(output).shape[1] == 1
      ):
          # DL models return only 1 for binary classification
          output = np.hstack((1 - output, output))
      desired_class = int(desired_class)
      maxvalues = np.max(output, 1)
      predicted_values = np.argmax(output, 1)
  
      # We iterate through output as we often call _predict_fn_custom for multiple inputs at once
      for i in range(len(output)):
          if output[i][desired_class] == maxvalues[i]:
              predicted_values[i] = desired_class
  
      return predicted_values
  
imports: import copy
  import random
  import timeit
  import numpy
  import pandas
  from raiutils.exceptions import UserConfigValidationException
  from dice_ml import diverse_counterfactuals
  from dice_ml.constants import ModelTypes
  from dice_ml.explainer_interfaces.explainer_base import ExplainerBase
label_desc: Use image node_id 11 for calling the DiceGenetic obj's underlying member method code with example usage: obj._predict_fn_custom(input_instance, desired_class) and returns: predicted_values