docstr: Infer the target class for generating CFs. Only called when
  model_type=="classifier".
  TODO: Add support for opposite desired class in multiclass.
  Downstream methods should decide whether it is allowed or not.
code: def infer_target_cfs_class(
      self, desired_class_input, original_pred, num_output_nodes
  ):
      """Infer the target class for generating CFs. Only called when
      model_type=="classifier".
      TODO: Add support for opposite desired class in multiclass.
      Downstream methods should decide whether it is allowed or not.
      """
      if desired_class_input == "opposite":
          if num_output_nodes == 2:
              # 'original_pred' needs to be converted to the proper class if 'original_pred' comes from the
              # 'predict_proba' method (length is 2 and class is index with maximum value). Otherwise 'original_pred'
              # already contains the class.
              if (
                  hasattr(original_pred, "__len__")
                  and len(original_pred) > 1
              ):
                  original_pred_1 = np.argmax(original_pred)
              else:
                  original_pred_1 = original_pred
              target_class = int(1 - original_pred_1)
              return target_class
          elif num_output_nodes == 1:  # only for pytorch DL model
              original_pred_1 = np.round(original_pred)
              target_class = int(1 - original_pred_1)
              return target_class
          elif num_output_nodes > 2:
              raise UserConfigValidationException(
                  "Desired class cannot be opposite if the number of classes is more than 2."
              )
      elif isinstance(desired_class_input, int):
          if num_output_nodes == 1:  # for DL models
              if desired_class_input in (0, 1):
                  target_class = desired_class_input
                  return target_class
              else:
                  raise UserConfigValidationException(
                      "Only 0, 1 are supported as desired class for binary classification!"
                  )
          elif (
              desired_class_input >= 0
              and desired_class_input < num_output_nodes
          ):
              target_class = desired_class_input
              return target_class
          else:
              raise UserConfigValidationException(
                  "Desired class not present in training data!"
              )
      else:
          raise UserConfigValidationException(
              "The target class for {0} could not be identified".format(
                  desired_class_input
              )
          )
  
imports: import pickle
  from abc import ABC, abstractmethod
  from collections.abc import Iterable
  from typing import Any, List
  import numpy
  import pandas
  from raiutils.exceptions import UserConfigValidationException
  from sklearn.neighbors import KDTree
  from tqdm import tqdm
  from dice_ml.constants import ModelTypes, _PostHocSparsityTypes
  from dice_ml.counterfactual_explanations import CounterfactualExplanations
label_desc: Use image node_id 17 for calling the ExplainerBase obj's underlying member method code with example usage: obj.infer_target_cfs_class(desired_class_input, original_pred, num_output_nodes) and returns: target_class, target_class, target_class, target_class